Skip to content

Conversation

reidbarber
Copy link
Member

@reidbarber reidbarber commented Oct 8, 2025

Closes #8992

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Go to an Autocomplete story, keyboard navigate down to 'Google', press ⌘+Enter, and verify that the link is opened in a new tab.

🧢 Your Project:

@rspbot
Copy link

rspbot commented Oct 8, 2025

LFDanLu
LFDanLu previously approved these changes Oct 8, 2025
if (item instanceof HTMLAnchorElement && item.href) {
openLink(item, e.nativeEvent);
} else if (item) {
item.click();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better this way? or better to use
item.dispatchEvent(new PointerEvent('click', {...})

or item.dispatchEvent(new e.nativeEvent.constructor(e.nativeEvent.type, e.nativeEvent))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that makes more sense. Just updated.

@rspbot
Copy link

rspbot commented Oct 10, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Autocomplete: Meta/Ctrl+Enter on menu items with href opens link in same tab instead of new tab when using virtual focus

4 participants