-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
- Open an app which does not have accessibility enabled by default and does on-load announcements to the user using
SemanticsService.announce
. - When a user navigates this UI a the screen reader, they navigate to the last announced announcement. They have to navigate past this announcement to get to the "Enable Accessibility" button.
- Some users using ChromeVox (I'm not sure how to provide a min repro), seem to experience the screen reader saying "Enable..." and then it being interrupted and the ChromeVox screen reader jumps past it.
Expected results
Ideally, Enable Accessibility is the first thing accessible and the user can get to it quickly.
Actual results
Noted in the steps above.
This happens because even before screen reader support is enabled on Flutter, web, the screen reader announcements do work. They appear on an element that's before the "Enable Accessibility" button.
Furthermore, when things are announced using a live element, the last announcement stays in the DOM:
https://github.com/flutter/engine/blob/82c30a04d0d5a2621a3c8abd08d3e6c8dd2e0e5d/lib/web_ui/lib/src/engine/semantics/accessibility.dart#L122-L127
This code also includes a hack to ensure that if the same announcement is made twice, it's still announced.
The way I've more commonly seen out-of-band announcements implemented is by appending a div with the message into the live element and then remove that div after a short time. That can be done here by replacing the code above with:
final messageElement = DivElement();
messageElement.text = message;
ariaLiveElement.append(messageElement);
Timer(Duration(milliseconds: 300), () {
messageElement.remove();
});
This also eliminates the need for the existing hack.
I've tested this on NVDA and it works a little better for our case where we announce on load.