Fix "Clone a Repository" repository list focus issues #16977
Merged
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/4054
xref: https://github.com/github/accessibility-audits/issues/4067
xref: https://github.com/github/accessibility-audits/issues/4056
Description
This PR is to solve a couple accessibility issues. 1) The list items in the cloning dialog were not properly highlighted, and the 2) list was not tab navigable too. I thought the two were closely related so worked them together.. turns out they are not, but small enough to have in one PR.
focusin
events on the list were not being registered. This was because the focus trap from the repository foldout was stoping the propagation of focus events if something outside of the focus trap originated it -> a dialog. This actually presented in any dialog that depended on thefocusin
event given an app foldout was open; it is just evident here because you open the clone dialog from the open repository fold out.[-1]
is not a valid value for theselectedRows
property in theList
component.selectedRow
property is-1
. Also, add a non fatal error to alert us of this issue in the future as it is not an obvious regression unless you typically navigate to the list with keyboard.Other solutions discussed:
isTopMost
to pass theenableFocusTrap
state down to toolbars whereever they are in the app hierarchy. Decided against since they were not far down the hierarchy, only 3 app toolbars, and these toolbars don't change often unlike dialogs where we may add future dialogs more frequently.Screenshots
Shows hitting tab from the filter input to the refresh button to the list and then using the up/down arrows to select items. The items are properly highlighted now.
CleanShot.2023-06-26.at.12.41.19.mp4
Release notes
Notes: [Fixed] The list in the "Clone a Repository" dialog is keyboard navigable to.
[Fixed] The selected list items in the "Clone a Repository" dialog are highlighted like other lists with proper contrast.