User stories
The following user stories can be used to understand when this component should be used, and how to know when it's been implemented correctly.
- As a keyboard-only user, I want focus to be redirected to the modal when it opens, and to the control that opened it when closed.
- As a keyboard-only user, I want to be able to quickly dismiss the modal using the Escape key.
- As a keyboard-only user, I want focus to be contained within the modal when it is open.
- As a screen reader user, I only want content within the modal to be readable when it is open.
-
As a screen reader user, I want to be able to understand that I am reading content in a modal, with its role announced as expected, and I want to understand the purpose of the modal, with its name announced.
Test steps
Use these steps to check that the Modal component has been implemented correctly:
- Turn on a screen reader.
- Navigate to the control that opens the modal and activate it.
- Verify that focus is moved to the now open modal.
- Verify that a role of modal is announced, as well as the name of the modal.
- Verify that both focus, and reading order, are limited to only content within the modal and any background content (now obscured by the modal) cannot be reached.
- Verify that when the modal is closed, focus is returned to the control that opened the modal.
Avoiding accessibility barriers
We're aware of the following barriers that can be introduced when using this component. Ensure that you are not adding barriers, by considering the following:
- When styling the modal with a custom background colour, ensure that there is at least a 4.5:1 colour contrast ratio between the text within the modal and the modal's background colour.
|
Accessibility checklist |
|
|---|---|
|
User stories |
✅ |
|
Avoiding accessibility barriers |
✅ |