Skip to content

fix(material/snack-bar): fix Firefox/JAWS not reading out snackbar me… #21552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2021

Conversation

annieyw
Copy link
Contributor

@annieyw annieyw commented Jan 12, 2021

…ssage

Add role="alert" to snackbar container.

Known issue: JAWS does not read out aria-live region unless it has role="alert"
https://bugzilla.mozilla.org/show_bug.cgi?id=1453673

Fixes #21137

@annieyw annieyw added P2 The issue is important to a large percentage of users, with a workaround Accessibility This issue is related to accessibility (a11y) target: patch This PR is targeted for the next patch release labels Jan 12, 2021
@annieyw annieyw requested a review from jelbourn January 12, 2021 13:11
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jan 12, 2021
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add this to a unit test assertion as well?

@@ -10,6 +10,6 @@
</div>

<!-- Will receive the snack bar content from the non-live div, move will happen a short delay after opening -->
<div [attr.aria-live]="_live"></div>
<div [attr.aria-live]="_live" role="alert"></div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment about why we need the role?

@jelbourn
Copy link
Member

cc @zelliott

I'm concerned this might have unintended consequences. One issue I see is that role="alert" is always treated as "assertive", which means they interrupt other content. I believe the default snackbar politeness should be "polite". Without testing I wouldn't know for sure, but I'd also wonder if having both aria-live and role="alert" would lead to double announcements.

The Firefox bug you point to also seems like the issue is somewhat inconsistent? It might be better to leave the snackbar as-is and leave this as a known Firefox + JAWS bug outside of our responsibility.

@zelliott
Copy link
Collaborator

cc @haywoodsloan as the resident snackbar expert I defer all snackbar questions to :)

@haywoodsloan
Copy link
Contributor

When I worked on #20487 I switched the snackbar from using role="alert" or role="status" to aria-live="assertive" and aria-live="polite". When testing JAWS, NVDA, VoiceOver, and ChromeVox I found aria-live gave more consistent behavior between the SRs. I did most of that testing on Chrome though.

I wouldn't recommend setting role="alert" statically as that does imply aria-live="assertive" and could cause unexpected behavior if aria-live="polite" is explicitly set. Could consider setting role="alert" when aria-live="assertive" and role="status" when aria-live="polite". I haven't tested having both set myself, but have seen recommendations to use both for maximum compatibility.

The only report I've seen of setting both role and aria-live causing issues is here: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions#preferring_specialized_live_region_roles. Potentially causing double speaking on VoiceOver on iOS, but that might be a fair tradeoff to support Firefox + JAWS better.

@jelbourn
Copy link
Member

We have precedent for only doing certain behaviors based on the platform (e.g. Firefox only) specifically for screen-reader issues like this. @annieyw we could explore using Platform to only add role="alert" or role="status" as appropriate for Firefox only.

@annieyw annieyw force-pushed the firefox-jaws-snackbar branch from 9f87bca to 4cba918 Compare January 14, 2021 09:27
@annieyw
Copy link
Contributor Author

annieyw commented Jan 14, 2021

Changed to only adding role for Firefox and added unit tests.

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jelbourn
Copy link
Member

Looks like the API gold needs to be updated

@annieyw annieyw force-pushed the firefox-jaws-snackbar branch from 4cba918 to eec9637 Compare January 15, 2021 13:06
@annieyw annieyw added the action: merge The PR is ready for merge by the caretaker label Jan 15, 2021
@mmalerba mmalerba merged commit 6cd2716 into angular:master Jan 19, 2021
mmalerba pushed a commit that referenced this pull request Jan 19, 2021
mmalerba pushed a commit that referenced this pull request Jan 19, 2021
@annieyw annieyw deleted the firefox-jaws-snackbar branch January 20, 2021 02:20
wagnermaciel pushed a commit to wagnermaciel/components that referenced this pull request Jan 20, 2021
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Accessibility This issue is related to accessibility (a11y) action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P2 The issue is important to a large percentage of users, with a workaround target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(material-experimental/mdc-snackbar): JAWS does not read mdc-snackbar message in Firefox
6 participants