Cmd-click doesn’t open s-page header buttons in a new tab

Hi! We recently moved from Polaris React to web components 1.1. Users noticed they can no longer Cmd-click our task editor’s Events and Versions buttons to open them in a new tab.

These are s-button elements with href, placed in the secondary-actions slot of s-page. Regular clicks work, but Cmd-click also navigates in the same tab.

Is this a known issue with the admin title bar? Is there a supported way to keep the usual new-tab behavior without moving the buttons out of the header?

Thanks!

Thanks for reporting this Matt. I’ve reproduced the same behavior. As a workaround, you can set target="_blank" on the button, although this opens the destination in a new tab for every click, not only for Cmd-click.

@Paige-Shopify target="_blank" is not a workaround, all clicks will open in a new page.

@matt

There is a known issue about it, though, things have changed recently and it’s easier to handle.

We use this hack to get it working well:

It’s using <Link> from polaris react - you can adapt to your use case.

The key is to add target _blank before the click happens when a modifier key is pressed, so the navigation is still handled natively by shopify