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 c154663
Browse filesBrowse the repository at this point in the historyBrowse files
[web] Preserve DOM focus on role update and honor isAccessibilityFocusBlocked (flutter#192963)
## Description
Fixes two web accessibility focus and modal-blocking regressions in
`lib/web_ui`:
1. **Preserve DOM focus across semantic role re-creation (`flutter#192792`)**:
When a focused `SemanticsObject` undergoes a semantic role transition
(`_updateRole()`, e.g., when a button transitions between enabled and
disabled states), `SemanticsRole.initState()` creates a replacement
`<flt-semantics>` DOM element (`replacesExistingElement: true`) and
replaces the old element in the DOM via `parent.replaceChild(...)`.
Previously, replacing a focused `<flt-semantics>` element caused the
browser to drop `document.activeElement` to `<body>`, breaking screen
reader and keyboard focus retention. `_updateRole()` now checks whether
the old element held `document.activeElement` before disposal and
restores `element.focusWithoutScroll()` when the node remains focusable.
2. **Honor `isAccessibilityFocusBlocked` (`BlockSemantics` / modal
barriers, `flutter#191484`)**: When
`SemanticsFlags.isAccessibilityFocusBlocked` is true on a node (set by
`BlockSemantics` / `ModalBarrier` for nodes behind an active dialog or
bottom sheet), `SemanticsObject` now exposes `aria-hidden="true"` and
omits `aria-label` in `LabelAndValue.update()` when no interactive child
nodes exist, preventing screen readers and automated accessibility
scanners from reading background nodes behind a modal barrier.
Fixesflutter#192792Fixesflutter#191484
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
0 commit comments