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

prevent focus behind/outside dialogs (WCAG 4.1.2) #6241

Open
cfm opened this issue Jan 29, 2022 · 0 comments
Open

prevent focus behind/outside dialogs (WCAG 4.1.2) #6241

cfm opened this issue Jan 29, 2022 · 0 comments
Labels
a11y Issues related to accessibility blocked js

Comments

@cfm
Copy link
Member

cfm commented Jan 29, 2022

Description

Accessibility Lab recommendation:

  • Keyboard
    The tab key must be constrained within the dialog. Users cannot tab out of the dialog. The focus goes to the dialog when it is activated, either to the dialog container, or to the dialog's heading, or to the first focusable element within the dialog, or to the default button in the dialog. There is some leeway in deciding where to send the focus. When the dialog is closed, the focus returns to the original trigger button, or to some other logical location if the button is no longer available or if the dialog was activated by something other than a button.

  • Screen Readers
    Screen readers will announce "Dialog" or "Alert Dialog" (depending on the dialog type), then they will announce the name of the dialog (usually designated by an aria-labelledby reference to the first heading in the dialog, but aria-label can also work), then they will announce the aria-describedby value, if present. If the focus was sent to a button, the screen reader will also read the button text. If the focus is sent to the container, the screen reader may begin to read the entire text content of the dialog, or may pause to wait for the user to start to navigate through the dialog.

As summarized by Ire Aderinokun:

  1. Markup the Dialog and Dialog Overlay Appropriately
  2. On Dialog Open, Set Focus
  3. On Dialog Close, Return Focus to the Last Focused Element
  4. While Open, Prevent Mouse Clicks Outside the Dialog
  5. While Open, Prevent Tabbing to Outside the Dialog
  6. Allow the ESC Key to Close the Dialog

(1) is implemented by #6041 and #6165. We cannot implement (2)–(6) without JavaScript, which means that these requirements cannot be satisfied in the Source Interface.

References

@cfm cfm changed the title determine whether we can (without JavaScript) prevent focus behind/outside dialogs (WCAG 4.1.2) prevent focus behind/outside dialogs (WCAG 4.1.2) Jan 29, 2022
@cfm cfm added a11y Issues related to accessibility blocked js labels Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y Issues related to accessibility blocked js
Projects
None yet
Development

No branches or pull requests

1 participant