Fix list scrolling in Commit Reachability Dialog #17421
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.
Description
We found that the list in the unreachable commits dialog had an odd bug where it continually moved focus to the first list item.
Screen.Recording.2023-09-21.at.16.56.39.mov
This was due to an accessibility fix that is meant to focus the first list item if no selected rows are provided.
The reason it impacts this list in particular is that we simply send in [] for selected rows and do not manage selected rows. The expectation of the above code is that we after setting focus to the first index, we bubble up a selection change and store that in a parent component. Then, the code to move to the first index would not fire again because the selected rows would no longer be [] .. but here we are just always sending in the [] instead of managing it.
This bit of logic scrolling logic fires on the
onFocusWithinChanged
which makes sense as to why scrolling works when you are not actively focusing the list.Other notes:
onSelectionChange
with documentation that parent component selected row management is required in theList
andSectionList
component required to ensure this kind of bug doesn't repeat itself.... or another way to address the focus first element issue if require parent component selected row management is not the route we want.test-notifications.tsx
, I did not test or address those as they are not user facing and was looking to target this PR fix.Screenshots
Screen.Recording.2023-09-21.at.12.12.14.PM.mov
Release notes
Notes: [Fixed] Scrolling works as expected in the "Commit Reachability" dialog.