[web] Update a11y announcements to append divs instead of setting content.#42258
[web] Update a11y announcements to append divs instead of setting content.#42258auto-submit[bot] merged 3 commits intoflutter:mainfrom
Conversation
…tent. This also removes the appended divs after a short time so that screen readers don't navigate to it, especially when users are entering the DOM to enable accessiblity. Fixes #127335.
|
|
||
| /// Duration for which a live message will be present in the DOM for the screen | ||
| /// reader to announce it. | ||
| const Duration liveMessageDuration = Duration(milliseconds: 300); |
There was a problem hiding this comment.
Can you please add a comment explaining the 300 value? Even if it's just "I tried with X, Y, and Z screen readers and they were all happy with this value". This would provide some context to a future maintainer who may doubt this value in the future for whatever reason.
|
|
||
| /// Duration for which a live message will be present in the DOM for the screen | ||
| /// reader to announce it. | ||
| const Duration liveMessageDuration = Duration(milliseconds: 300); |
There was a problem hiding this comment.
Instead of making this a const can this be mutable so that tests can set a smaller duration than 300ms? I don't know how many tests we currently have, but if the union of all tests have to await on this 10 times, it lengthens the runtime of the test by 3 seconds. I think we could use 10 times smaller delays in the tests.
|
auto label is removed for flutter/engine, pr: 42258, due to This PR has not met approval requirements for merging. You are not a member of flutter-hackers and need 1 more review(s) in order to merge this PR.
|
htoor3
left a comment
There was a problem hiding this comment.
Just left some minor test comments, but lgtm otherwise
| accessibilityAnnouncements.handleMessage(codec, codec.encodeMessage(testInput)); | ||
| expect(accessibilityAnnouncements.ariaLiveElementFor(Assertiveness.polite).text, 'polite message'); | ||
| expect(accessibilityAnnouncements.ariaLiveElementFor(Assertiveness.assertive).text, ''); | ||
| test('aria-live is polite when assertiveness is set to 0', () async { |
There was a problem hiding this comment.
Do we know/care what happens if assertiveness is a negative int? Or is this not a scenario we'll run into
There was a problem hiding this comment.
It's not a scenario we should run into - it would give an index out of bounds. This is a serialization of the Assertiveness enum. It's converted back to the enum using Assertiveness.values[deserializedAssertiveness]:
| accessibilityAnnouncements.handleMessage(codec, codec.encodeMessage(testInput3)); | ||
| expect(accessibilityAnnouncements.ariaLiveElementFor(Assertiveness.polite).text, 'Hello'); | ||
| expect(accessibilityAnnouncements.ariaLiveElementFor(Assertiveness.assertive).text, ''); | ||
| test('Rapid-fire messages are each announced.', () async { |
There was a problem hiding this comment.
Does this behavior change if mixed assertive/polite rapid-fire messages are sent, rather than just polite?
There was a problem hiding this comment.
Nope. Nothing fundamentally changes. They go into different live divs, each of which is handled independently. These tests ensure that multiple messages of the same type don't clobber each other in any way.
flutter/engine@c641f63...9ba461e 2023-05-24 [email protected] [web] Remove comment about dart:html migration (flutter/engine#42290) 2023-05-24 [email protected] [web] Hide JS types from dart:ui_web (flutter/engine#42252) 2023-05-24 [email protected] Roll Fuchsia Mac SDK from qoLy9E5PjnAlICjUb... to RSSC61ubl9JXmn4JO... (flutter/engine#42287) 2023-05-24 [email protected] [web] Update a11y announcements to append divs instead of setting content. (flutter/engine#42258) 2023-05-24 [email protected] [Impeller] fix Xcode frame capture. (flutter/engine#42289) 2023-05-24 [email protected] [Impeller] Create an autorelease pool for Impeller tests running on macOS. (flutter/engine#42265) Also rolling transitive DEPS: fuchsia/sdk/core/mac-amd64 from qoLy9E5PjnAl to RSSC61ubl9JX If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

This also removes the appended divs after a short time so that screen readers don't navigate to it, especially when users are entering the DOM to enable accessiblity.
Fixes flutter/flutter#127335.
Pre-launch Checklist
///).