Skip to content

Open footer social links in a new tab FEDEV-4007#2624

Open
qwinndev wants to merge 2 commits into
releasefrom
footer-social-new-tab-FEDEV-4007
Open

Open footer social links in a new tab FEDEV-4007#2624
qwinndev wants to merge 2 commits into
releasefrom
footer-social-new-tab-FEDEV-4007

Conversation

@qwinndev

@qwinndev qwinndev commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Problem

Footer social icons (X, Substack, Github, Telegram, Discord) opened the external site in the same browser tab, taking the user away from the GMX app.

Two things combined to cause this:

  1. The social <Button> was given href — but Button only renders a real anchor (via ButtonLink, which applies target="_blank" rel="noopener") when to is set. With href plus the onClick injected by TrackingLink, it rendered a plain <button>, so newTab was ignored.
  2. TrackingLink overrode the child's onClick, called e.preventDefault(), and then navigated with window.location.href = children.props.href — always in the same tab.

Fix

  • Footer.tsx: render the social Button with to instead of href, so it renders a proper external link with target="_blank" rel="noopener".
  • TrackingLink.tsx: for new-tab children, don't preventDefault/navigate manually — fire tracking and let the browser open the new tab natively. (Doing window.open after an await would be popup-blocked; relying on the anchor's native default action isn't.) Same-tab links keep the previous behavior.

Both the desktop footer and the mobile side-nav footer render the same Footer component, so both are fixed. Non-social footer links are untouched, and social click tracking still fires for each icon.

https://linear.app/gmx-io/issue/FEDEV-4007/bug-footer-social-icons-open-in-the-same-tab-instead-of-a-new-tab

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 8, 2026

Copy link
Copy Markdown

Deploying gmx-interface-home with  Cloudflare Pages  Cloudflare Pages

Latest commit: bbe107f
Status: ✅  Deploy successful!
Preview URL: https://7c30c33a.gmx-interface-home.pages.dev
Branch Preview URL: https://footer-social-new-tab-fedev.gmx-interface-home.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 8, 2026

Copy link
Copy Markdown

Deploying gmx-interface with  Cloudflare Pages  Cloudflare Pages

Latest commit: bbe107f
Status: ✅  Deploy successful!
Preview URL: https://693d5c22.gmx-interface.pages.dev
Branch Preview URL: https://footer-social-new-tab-fedev.gmx-interface.pages.dev

View logs

Footer social icons navigated in the same tab: the Button used `href`
(which Button ignores unless `to` is set), so it rendered a plain
`<button>`, and TrackingLink hijacked the click with a same-tab
`window.location.href` navigation.

Render the social Button as a real external link via `to` so ButtonLink
applies `target="_blank" rel="noopener"`, and let TrackingLink skip its
manual navigation for new-tab links — the browser opens the new tab
natively while tracking still fires.
@qwinndev qwinndev force-pushed the footer-social-new-tab-FEDEV-4007 branch from b083e58 to 280cbf9 Compare July 8, 2026 14:45
@github-actions

Copy link
Copy Markdown

Playwright Component Test Report

All tests passed.

View Report

Commit bbe107f

@qwinndev qwinndev changed the title fix: open footer social links in a new tab FEDEV-4007 Open footer social links in a new tab FEDEV-4007 Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant