Repository navigation
[VPAT] Describe the a11y_assessments dialog for screen readers - #13462
Conversation
There was a problem hiding this comment.
Code Review
This pull request wraps the dialog text in a Semantics widget to allow screen readers to describe the dialog, and adds a widget test to verify this behavior. The review feedback recommends declaring the Semantics widget as const to optimize widget tree rebuilds.
| Semantics( | ||
| container: true, | ||
| namesRoute: true, | ||
| child: const Text('This is a typical dialog.'), | ||
| ), |
There was a problem hiding this comment.
The Semantics widget and its child subtree can be declared as const. In Flutter, using const constructors where possible is a recommended performance best practice because it allows the framework to cache the widget and avoid redundant rebuilds.
| Semantics( | |
| container: true, | |
| namesRoute: true, | |
| child: const Text('This is a typical dialog.'), | |
| ), | |
| const Semantics( | |
| container: true, | |
| namesRoute: true, | |
| child: Text('This is a typical dialog.'), | |
| ), |
References
- Prefer using const constructors for widgets where possible to optimize widget tree rebuilds and performance, as recommended by the Dart style guide (Effective Dart). (link)
There was a problem hiding this comment.
The default Semantics constructor isn't const, so const Semantics(...) doesn't compile. Only Semantics.fromProperties is. prefer_const_constructors is enabled here and passes, and the Text child is already const. Keeping it as is.
flutter/packages@3742a4e...3f34a6f 2026-11-01 [email protected] Roll Flutter from ee8b482 to fcfb4f2 (3 revisions) (flutter/packages#13520) 2026-10-31 [email protected] Roll Flutter from 5e805bf to ee8b482 (17 revisions) (flutter/packages#13512) 2026-10-30 [email protected] [VPAT] Describe the a11y_assessments dialog for screen readers (flutter/packages#13462) 2026-10-30 [email protected] [go_router_builder] Allow `build` 5 (flutter/packages#13455) 2026-10-30 [email protected] [go_router] Support nested parentheses, groups, and lookaround assertions in path parameters (flutter/packages#12571) 2026-10-30 [email protected] [in_app_purchase_storekit] Add SK2Transaction.currentEntitlements() (flutter/packages#13373) 2026-10-30 [email protected] [all] Remove broken .claude/skills symlink (flutter/packages#13492) 2026-10-30 [email protected] Roll Flutter from c091098 to 5e805bf (15 revisions) (flutter/packages#13504) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
flutter/packages@3742a4e...3f34a6f 2026-11-01 [email protected] Roll Flutter from ee8b482 to fcfb4f2 (3 revisions) (flutter/packages#13520) 2026-10-31 [email protected] Roll Flutter from 5e805bf to ee8b482 (17 revisions) (flutter/packages#13512) 2026-10-30 [email protected] [VPAT] Describe the a11y_assessments dialog for screen readers (flutter/packages#13462) 2026-10-30 [email protected] [go_router_builder] Allow `build` 5 (flutter/packages#13455) 2026-10-30 [email protected] [go_router] Support nested parentheses, groups, and lookaround assertions in path parameters (flutter/packages#12571) 2026-10-30 [email protected] [in_app_purchase_storekit] Add SK2Transaction.currentEntitlements() (flutter/packages#13373) 2026-10-30 [email protected] [all] Remove broken .claude/skills symlink (flutter/packages#13492) 2026-10-30 [email protected] Roll Flutter from c091098 to 5e805bf (15 revisions) (flutter/packages#13504) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Problem
On the a11y_assessments dialog demo, screen readers do not read the dialog text. When the dialog opens, focus moves to the autofocused OK button and VoiceOver only says "OK, button". The text merges into the dialog's semantics node as its label, and on web a dialog's label is not exposed unless it names the route, so the text never reaches the DOM.
Fix
The text gets its own semantics node with
namesRoute: true. On web the dialog'saria-describedbythen points at it, so screen readers read it as the dialog's description when it opens. OK keeps its autofocus. A new test checks that the text names the dialog.Demo
Run the test app on web, open #/dialog, turn on VoiceOver, and activate Show Dialog. Before, only "OK, button" is read. After, VoiceOver also reads "This is a typical dialog."