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
fix(modal): focus the dialog wrapper on present so screen readers can enter the modal (#31260)
Issue number: internal
---------
## What is the current behavior?
When a modal is opened with Android TalkBack enabled, the screen reader
cannot enter or navigate the modal's content. On present, focus is moved
to the modal host, but the host is role-less. The `role="dialog"`,
`aria-modal`, and the label live on the inner `.ion-overlay-wrapper` so
assistive technologies have no dialog to land on.
## What is the new behavior?
- `present()` now focuses the overlay's `[role="dialog"]` element (the
wrapper) instead of the role-less host, falling back to the host when
the role is on the host (action-sheet, loading).
- The modal wrapper gets `tabIndex="-1"` so it can receive that
programmatic focus (an element with only `role="dialog"` is not
focusable). Its focus ring is suppressed since the focus is
programmatic, not keyboard-driven.
- Clears text selection when gestures start to prevent Firefox from
interrupting swipe-to-close and sheet gestures.
- Adds an e2e test to `modal/test/a11y/modal.e2e.ts` to verify no
visible outline added to the wrapper.
- Adds e2e tests to `utils/test/overlays/overlays.e2e.ts` to verify the
focus is on the wrapper instead of the host for all modals.
- Fixes Playwright test helper to clear text selection immediately after
`mouse.down()` to prevent the selection from blocking gesture detection
in the test environment.
---------
Co-authored-by: Brandy Smith <brandyscarney@users.noreply.github.com>
Co-authored-by: Brandy Smith <6577830+brandyscarney@users.noreply.github.com>
0 commit comments