-
Notifications
You must be signed in to change notification settings - Fork 536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore "fix: Don’t focus first 'Item' of 'DropdownMenu' and 'SelectMenu' on open" #1293
Conversation
🦋 Changeset detectedLatest commit: 763bb58 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/primer/primer-components/9dYWSspQXzxKB5hAmcx9utTKW7Wg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tracking this down 🏅
Reverts #1291, restoring #1270
When these lines (from #1270) removed temporary
tabIndex
from thecontainer
, certain browsers (e.g. Chrome) (but not others, e.g. Safari) setbody
as theactiveElement
. Becausebody
is outsideFocusTrap
(andFocusZone
), keyboard navigation between thecontainer
’s children was no longer possible.By deferring the removal of the temporary
tabIndex
until thecontainer
has already lost focus, we avoid focusingbody
, and so we avoid breaking keyboard navigation. I added code comments in this PR to explain this slightly-more-complicated codepath and the scenario it prevents.ℹ️ Reviewing this commit may help clarify the difference between this PR’s approach and that in #1270: b343d47
Screen recordings
Safari
Chrome
Checklist