-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] Update a11y announcements to append divs instead of setting content. #42258
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
|
||
| /// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
yjbanov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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]:
| final Assertiveness assertiveness = Assertiveness.values[assertivenessIndex]; |
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this behavior change if mixed assertive/polite rapid-fire messages are sent, rather than just polite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
…127536) 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
///).