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

Accessibility: Modals #11823

Closed
cjcenizal opened this issue May 16, 2017 · 2 comments
Closed

Accessibility: Modals #11823

cjcenizal opened this issue May 16, 2017 · 2 comments
Labels
bug Fixes for quality problems that affect the customer experience Project:Accessibility Team:Platform-Design Team Label for Kibana Design Team. Support the Analyze group of plugins.

Comments

@cjcenizal
Copy link
Contributor

We need to make sure our modals are keyboard- and screen-reader-accessible. For the full breakdown, see https://www.marcozehe.de/2015/02/05/advanced-aria-tip-2-accessible-modal-dialogs/.

Here's an example of some of the markup we need:

<div role="dialog" aria-labelledby="modalTitle" aria-describedby="modalDescription">
  <div id="modalTitle">Save "untitled" document?</div>
  <div id="modalDescription">You have made changes to "untitled.txt" that have not been saved. What do you want to do?</div>
  <button type="button">Save changes</button>
  <button type="button">Discard changes</button>
  <button type="button">Cancel</button>
</div>

Here are the crib notes:

  • Add role="dialog" to the Modal root element.
  • Use aria-labelledby and aria-describedby to point screen readers to the title and body text of the modal.
  • When the modal is opened, focus on the first tabbable element.
  • Use JS to trap tabbing within the modal. Add keypress handlers to the first and last tabbable elements so that tabbing from the last element focuses on the first one, and shift-tabbing from the first element focuses on the last one.
  • Add an ESC keypress handler, so hitting escape closes the modal.
  • When the modal is closed, use JS to restore focus to the element which was last focused (this should be the button which was clicked to open the modal).
@cjcenizal cjcenizal added the Team:Platform-Design Team Label for Kibana Design Team. Support the Analyze group of plugins. label May 16, 2017
This was referenced May 16, 2017
@stacey-gammon
Copy link
Contributor

Will also need to update the new clone modal to be accessible: #10925

Tagging here just to keep track.

@tbragin tbragin added the bug Fixes for quality problems that affect the customer experience label Jul 28, 2017
@cjcenizal
Copy link
Contributor Author

Moved to elastic/eui#502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Project:Accessibility Team:Platform-Design Team Label for Kibana Design Team. Support the Analyze group of plugins.
Projects
None yet
Development

No branches or pull requests

3 participants