You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c0eb79e
Browse filesBrowse the repository at this point in the historyBrowse files
fix(overlays): keep focus inside modal and popover when tabbing in Chrome 157+ (#31755)
Issue number: internal
## What is the current behavior?
In Chrome 157 and later, pressing Tab on the last focusable element of a
presented `ion-modal` or `ion-popover` moves focus out of the overlay.
Chrome now lets Tab move focus off the end of the page without firing a
`focus` event, so the document focus listener that traps focus never
runs. Alert, action sheet and loading are not affected because they
already render focusable sentinels around their content.
## What is the new behavior?
- Modal and popover render a focusable boundary before and after their
content. A boundary moves focus to the first or last focusable element,
so Tab wraps without focus leaving the page.
- Alert, action sheet and loading use the same shared boundary in place
of their own sentinels, and the scoped focus trap in `overlays.ts` no
longer wraps focus itself.
- Boundaries are hidden while the focus trap is off
(`focusTrap="false"`, or a sheet modal below its `backdropBreakpoint`),
so focus can still leave the overlay.
- Shift+Tab from the alert wrapper now wraps to the last button.
Previously it moved to the first button.
## Does this introduce a breaking change?
- [ ] Yes
- [x] No
## Other information
- Test on localhost, not the Vercel preview. The Vercel toolbar's
floating button sits after the overlay and catches the Tab, which hides
the bug on `main`.
- Unblocks the Playwright 1.65 update in #31714, where the Mobile Chrome
focus trap tests fail on this Chrome change.
- In Firefox, the first Tab into a popover now lands on the native
`textarea` inside `ion-textarea` instead of the `ion-textarea` host,
which matches Chrome and Safari. The extra Firefox-only Tab in the
popover textarea test was removed.
- Checked with VoiceOver in Safari and Chrome: Tab wraps announce only
the newly focused element, and the VoiceOver cursor never stops on a
boundary, the same as on `main`.
---------
Co-authored-by: ShaneK <561207+ShaneK@users.noreply.github.com>
0 commit comments