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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Combobox] Tab sequence gets stuck in popover interactive elements #545
Comments
This is perhaps a separate issue, but a fresh build of the website also warns that certain |
There has been some discussion on how we handle this by default in various components. All of the ARIA examples I've seen that implement popovers with interactive content do in fact lock focus in the popover, though some UI specs don't mention it explicitly (particularly if the example doesn't use nested tabbable elements). My general feeling is aligned with yours here, and that's the default approach taken in That said, no idea why the behavior wouldn't be consistent between the docs and local build. Haven't had a problem building the site locally on my end or in CI 馃 |
I think the root of the problem lies in Popover. Hear me out! All of the examples where tab sequence is not disrupted have focusable elements before and after the component. I added a sibling Or, using Alas, if you reduce the Popover example down to a single I'll try to take a closer look later, but on first guess, the devil is somewhere here: reach-ui/packages/popover/src/index.tsx Line 193 in 52d721c
|
I dunno if this makes sense, but these changes to function focusLastTabbableInPopover(event: KeyboardEvent) {
const elements = popoverRef.current && tabbable(popoverRef.current);
+ // The actual last tabbable should be the trigger.
+ // We push it manually to the array because it is outside of the portal of popover.
+ triggerRef.current && elements?.push(triggerRef.current);
const last = elements && elements[elements.length - 1];
if (last) {
event.preventDefault();
last.focus();
}
} |
I too believe that the issue relates to Popover, specifically cases where the I submitted a PR (#609) that should address the issue. I recreated the original example referenced in this issue and the focus now moves outside the popover as expected. |
Should be fixed in 0.10.4. Please let me know if you continue to have issues. |
馃悰 Bug report
Current Behavior
When tabbing to interactive elements in the popover, the tab sequence gets stuck in the popover
Compare this to the popover itself, which does not track the tab sequence.
Interestingly, the tab sequence issue is not reproducible on the website examples, despite creating a clean slate with
cd website/ && rm -rf node_modules && yarn && yarn dev
.Expected behavior
There is nothing mentioned on WAI ARIA about trapping focus in the listbox popover, so I would expect the tab sequence to predictably follow the browser default sequence, i.e. how the current Reach UI popover component behaves (as shown above).
Reproducible example
CodeSandbox Template
Running the Storybook examples locally will also reproduce this issue
Suggested solution(s)
Even after tinkering locally, its not clear to me why the tab sequence is trapped in the combobox popover (and also why it isn't on the website examples).
Additional context
Your environment
The text was updated successfully, but these errors were encountered: