Fix focus order when shift-tabbing from co-authors input text #19517
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
xref. https://github.com/github/accessibility-audits/issues/8568
Description
The problem was that when shift-tabbing from the co-authors input text, the focus would go into an item of the autocomplete list right before closing the autocomplete list, so the focused element would be immediately removed and focus would go to the
body
element.This PR makes the list inside the autocomplete component not focusable with the
Tab
key, which prevents the focus from going into the list when shift-tabbing from the co-authors input text.Given we are using
aria-activedescendant
to manage focus inside the autocomplete list, we keep the DOM focus in the input text. That means, "shift-tabbing" from that scenario should move the DOM focus to the "toggle co-authors" button and the DOM focus should never go to the autocomplete list.Screenshots
CleanShot.2024-11-07.at.13.00.04.mp4
Release notes
Notes: [Fixed] Fix logical tab order from co-authors text box