Repository navigation
[menu][popover][combobox] Fix focus guard handling - #3654
Conversation
commit: |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
79b8d8c to
5ccff51
Compare
| let nextTabbable = getTabbableAfterElement( | ||
| store.context.triggerFocusTargetRef.current || triggerElementRef.current, | ||
| ); |
There was a problem hiding this comment.
In Safari, aria-hidden={false} on the focus guard, so it should look for next tabbable starting from (after) the focus guard
|
|
||
| const focus = useFocus(floatingRootContext, { | ||
| enabled: !disabled && ((!isInMenubar && isOpenedByThisTrigger) || parentMenubarHasSubmenuOpen), | ||
| enabled: !disabled && parentMenubarHasSubmenuOpen, |
There was a problem hiding this comment.
This otherwise causes Shift + Tab not to close the popup when focus lands back on the trigger in Menu; seems to still pass all Menubar tests
fef44c4 to
5b5d512
Compare
LukasTy
left a comment
There was a problem hiding this comment.
Looks great. 👍
Very nice improvement when running on Safari.
However, have you checked Firefox? It is broken with tabbing to an after (Tab) element, only works with before (Shift+Tab). 🤷
5b5d512 to
bc8308b
Compare
|
@LukasTy can't reproduce anymore after rebasing with main 🤔 I noticed a bug with React hydration would break the behavior in dev mode though, when the hydration error appeared in the console |
|
@atomiks I can confirm that it works as expected in Firefox on https://master--base-ui.netlify.app/experiments/popup-tabbing. |
Fixes a few issues with the focus guards:
https://deploy-preview-3654--base-ui.netlify.app/experiments/popup-tabbing