Skip to content

Flutter-web: Screen reader navigation in the presence of an on-load announcement navigates through that announcement #127335

@marcianx

Description

@marcianx

Is there an existing issue for this?

Steps to reproduce

  1. Open an app which does not have accessibility enabled by default and does on-load announcements to the user using SemanticsService.announce.
  2. 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.
  3. 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.

Metadata

Metadata

Assignees

Labels

P0Critical issues such as a build break or regressiona: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)customer: googleVarious Google teamsplatform-webWeb applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions