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

Accessible screen reader live region and notifications #359

Merged
merged 19 commits into from
Jul 24, 2019
Merged

Accessible screen reader live region and notifications #359

merged 19 commits into from
Jul 24, 2019

Conversation

cee-chen
Copy link
Member

@cee-chen cee-chen commented Jul 19, 2019

Description

This is an an accessibility PR that provides more context and information to screen reader users. The goal is to announce the results/consequences of certain actions being taken to users, so that visually impaired users aren't left wondering what happened after pressing a button.

For example:

  • After clicking the "+ More" button in the filters sidebar, a screen reader user should know how many total filters are now being shown.
  • After pressing the search button, a screen reader user should know how many results are being shown and how many total results were returned.
  • After navigating to another page of results, a screen reader user should have the results/paging info read out to them (same as above)
  • After changing how many results are being shown per-page, a screen reader user should have the results/paging info read out to them (same as above)

Screencaps

Search results announcements:

search-results-screencap

+ More Filters annoucements:

more-filters-screencap

List of changes

  • Adds a new a11yNotifications flag to our SearchDriver config.
    • This will add a visually hidden live region to the end of document which will inform screen readers of app-wide changes in response to actions that users have taken.
    • Placing this in our vanilla JS SearchDriver allows all users, not just developers using our React UI, to enjoy a more accessible experience.
    • It's currently defaulted to false for a non-breaking 1.1 release, but will be flipped over to a true default for our upcoming 2.0 release.
  • Adds a new a11yNotificationMessages key to our SearchDriver config
    • This allows developers to override our accessibility phrasing/messages, e.g. for localization.
    • This also allows developers to add their own completely custom screen reader notifications if needed.
  • Adds a new a11yNotify action to SearchDriver / withSearch
    • Per above, this allows developers to add their own custom screen reader notifications in their custom views/components.

Associated Github Issues

Fixes #325

PRs: See #320 and #355 for initial WIP work towards this final architecture.

- a11yNotifications flag/bool
- a11yNotify action
- this.a11yNotificationMessages
+ ability to pass in all custom SearchDriver config options to setupDriver test helper
+ DRY out PagingInfoContainer logic
so as to be non-breaking for any projects already shipping their own accessibility notices

this will default to true in 2.0
ADVANCED.md Show resolved Hide resolved
ADVANCED.md Outdated Show resolved Hide resolved
ADVANCED.md Show resolved Hide resolved
examples/sandbox/src/App.js Outdated Show resolved Hide resolved
packages/search-ui/src/SearchDriver.js Outdated Show resolved Hide resolved
packages/search-ui/src/SearchDriver.js Show resolved Hide resolved
JasonStoltz
JasonStoltz previously approved these changes Jul 22, 2019
ADVANCED.md Outdated Show resolved Hide resolved
packages/react-search-ui/src/containers/Facet.js Outdated Show resolved Hide resolved
packages/search-ui/src/test/helpers.js Outdated Show resolved Hide resolved
packages/search-ui/src/A11yNotifications.js Outdated Show resolved Hide resolved
packages/search-ui/src/A11yNotifications.js Show resolved Hide resolved
packages/search-ui/src/actions/a11yNotify.js Outdated Show resolved Hide resolved
packages/search-ui/src/actions/a11yNotify.js Outdated Show resolved Hide resolved
packages/search-ui/src/actions/a11yNotify.js Outdated Show resolved Hide resolved
cee-chen and others added 4 commits July 23, 2019 10:53
- Note that console.warn and console.error still seem to be output by jest no matter what :(
- Moving the message func to react-search-ui, so that non-react users don't inherit a UI message function they aren't using
@cee-chen
Copy link
Member Author

Alrighty - all of @yakhinvadim's feedback should have been addressed at this point! I'd love a quick re-review of any added/changed functionality (don't hesitate to flag anything that you're skeptical of that was added after feedback, I truly don't mind).

As a heads up also once this PR has been finalized/merged, I'll probably go back and un-collapse a few comments that contain useful info that I think will be handy to have as historical reference :)

Copy link
Contributor

@yakhinvadim yakhinvadim left a comment

Choose a reason for hiding this comment

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

This is great! I have only one comment. Also, waiting for Jason's thoughts in this discussion: #359 (comment)

packages/react-search-ui/src/SearchProvider.js Outdated Show resolved Hide resolved
Copy link
Contributor

@yakhinvadim yakhinvadim left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Really happy we'll see this in the next release.

@JasonStoltz JasonStoltz merged commit 0cae2f5 into elastic:master Jul 24, 2019
@cee-chen cee-chen deleted the a11y-notifications branch July 24, 2019 19:38
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.

Add screen reader live region support
3 participants