[SG-35532] Accessibility: Compare page: Focus lost when selecting a revision
Created by: gitstart-sourcegraph
Description
After opening Popover and selecting revision to compare on the repository comparison page the focus doesn't return to the trigger button.
- This happens for
Popover
which rendersInput
withautoFocus
Problem description
Using a keyboard, select a revision like this: Notice that focus is lost
This happens in components with PopoverContent with text field + autoFocus inside
Expected behavior
Focus should be returned to the trigger that opened the selector (the button)
Refs
Test plan
- Navigate to this page trigger the revision popover buttons,. These buttons should regain focus after popover is closed.
- Do same for other use cases of popover
Limitation
Unable to cleanly maintain focus on RepoContainer
's Popover since useMemo
gets re-rendered (Input element's autoFocus takes the focus here) when we control open state of Popover
as in other use cases.
App preview:
Check out the client app preview documentation to learn more.