Skip to content
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

[core] feat(Overlay): set aria-live attribute for a11y #4900

Merged
merged 1 commit into from
Sep 14, 2021

Conversation

michael-yx-wu
Copy link
Contributor

@michael-yx-wu michael-yx-wu commented Sep 14, 2021

Fixes #4813

Checklist

  • Includes tests
  • Update documentation (n/a)

Changes proposed in this pull request:

Set aria-live on Overlay

This allows screen readers to read content in Tooltips, Popovers,
Dialogs, and Overlays when they are opened.

Not using aria-describedby because the Overlay content is typically
added to the DOM after interaction with some other element, leaving
screen readers unable to consistently see the content in time. Setting
aria-live on the Overlay works because it remains mounted after the
initial open. VoiceOver is also able to read the content on initial
open (did not test with other screen readers).

Reviewers should focus on:

This behavior change is not limited to Tooltips/Tooltips2 but affects all consumers of the Overlay component. When using a screen reader, Overlay contents will be read on open. I think this is desirable, because otherwise non-keyboard-focusable elements in Overlay contents, namely large blocks of text, will not get read.

Screenshot

Initial attempt with aria-describedby and setting content id results in inconsistent reading of tooltip

First focus over "Or, hover of this whole line" does not read the tooltip, but a second focus does.

2021-09-13 17 15 56

(In this PR) Using aria-live="polite"

Works consistently with or without portals. The tooltips on the last line have usePortal set to false.

In Chrome:
2021-09-13 19 03 41

In FF:
2021-09-13 20 13 04

This allows screen readers to read content in Tooltips, Popovers,
Dialogs, and Overlays when they are opened.

Not using aria-describedby because the Overlay content is typically
added to the DOM after interaction with some other element, leaving
screen readers unable to consistently see the content in time. Setting
aria-live on the Overlay works because it remains mounted after the
initial open. VoiceOver is also able to read the content on initial
open (did not test with other screen readers).
@adidahiya adidahiya changed the title Set aria-live on Overlay [core] feat(Overlay): set aria-live attribute for a11y Sep 14, 2021
@adidahiya adidahiya merged commit 34599ae into develop Sep 14, 2021
@adidahiya adidahiya deleted the mw/tooltip-aria-describedby branch September 14, 2021 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tooltip targets should have aria-describedby and tooltip contents should have a corresponding ID
3 participants