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

Re-implement accessible dialogs #77

Closed
lyzadanger opened this issue May 25, 2021 · 0 comments · Fixed by #960
Closed

Re-implement accessible dialogs #77

lyzadanger opened this issue May 25, 2021 · 0 comments · Fixed by #960

Comments

@lyzadanger
Copy link
Contributor

lyzadanger commented May 25, 2021

This ticket serves as a container for tasks related to making our modals and dialogs more accessible and usable. This may turn into a project at some point. This issue is not actionable at this time as written.


The Dialog component added here: #75 was copied over from previous implementation in the client (which came from lms).

Tasks

  • Capturing and managing focus
  • The logic for determining aria-describedby to see if we can find something a little less fragile-feeling
  • The logic for generating element IDs to make sure there aren't potential collisions

Disabling scrolling

Consider disabling scrolling on window.document when modal is open.

One possible implementation:
https://github.com/hypothesis/client/blob/6cae566ee5ae5d2dd88aa00954ea0f6a69dfb530/src/annotator/components/NotebookModal.js#L55-L78

Disallowing click-elsewhere or esc-to-close

There are cases when we use a Modal component in which it shouldn't be possible to close the modal without choosing an adventure (i.e. clicking a button).

"Cancel" may still be valid, and may still close the modal. But in some cases, it's problematic to have clicks outside of the modal component close the modal—e.g. in certain LMS contexts—or it's "too easy" to accidentally close a modal. And/or the close button (X) is misleading or distracting.

Before we do this, we need to look into proper focus-trapping (see Keyboard Support section of https://www.w3.org/TR/wai-aria-practices-1.1/examples/dialog-modal/dialog.html).

One implementation approach that's been looked at here involves updating the useElementShouldClose hook to be configurable.

Initial focus to...?

Might be helpful to set initial focus on an action button of some sort?

@lyzadanger lyzadanger added the pattern library concerning the build, structure, styling or components for the pattern library label May 25, 2021
@lyzadanger lyzadanger added component concerning a UI component that is part of the package API and removed pattern library concerning the build, structure, styling or components for the pattern library labels Sep 10, 2021
@lyzadanger lyzadanger changed the title Revisit Dialog component: a11y logic Improve accessibility and extensibility of modals, panels and dialogs Jun 15, 2022
@lyzadanger lyzadanger added project and removed project component concerning a UI component that is part of the package API labels Jun 15, 2022
@lyzadanger lyzadanger changed the title Improve accessibility and extensibility of modals, panels and dialogs Re-implement accessible dialogs Feb 22, 2023
@lyzadanger lyzadanger added this to the Updated Dialog component milestone Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant