fix(button): double tab navigation when clicking button/action-button with href and target="_blank"#5937
fix(button): double tab navigation when clicking button/action-button with href and target="_blank"#5937
Conversation
🦋 Changeset detectedLatest commit: 414e7bf The changes in this PR will be included in the next version bump. This PR includes changesets to release 84 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
@Rajdeepc links don't activate via space. |
Description
Fixes an issue where clicking
sp-buttonorsp-action-buttonwithhrefandtarget="_blank"attributes opened two browser tabs in Chrome instead of one.Root cause
The
ButtonBasecomponent renders an anchor element withposition: absolute; inset: 0that overlays the entire button. When clicked:handleClickCapturecatches the click and callsshouldProxyClick()→anchorElement.click()→ first navigationThis only manifested in Chrome due to how it handles click event propagation on absolutely-positioned elements within shadow DOM.
Solution
Check if the anchor element is already in the click event's
composedPath()before triggering a proxy click. If the anchor is in the path, the browser will handle navigation naturally and no proxy is needed.Motivation and context
Related issue(s)
Screenshots (if appropriate)
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
Modifier Clicks
VO testing
Keyboard Testing
Device review