Closed dpersing closed 4 years ago
Retested as part of support for merchandising.
We can keep an eye on inert
support in regard to modals as well.
The button that closes the modal has no text equivalent for the icon. Screen reader users will not be able to tell what the button does.
This item will be addressed by PR #1582.
Focus
The modal does not receive focus automatically in Chrome. Chrome users must tab once to access the modal content.
It's possible to tab out of the modal before it is closed.
When the modal is closed with the keyboard, either by activating the X button or via the esc key, where focus moves is not immediately apparent to the user. Pressing tab after the modal closes causes focus to appear on the control that launched the button, but users will generally expect focus to return to the control that launched the interaction when it closes. (This looks like it should be working in code?)
When the first audit was done, our overlay components like Modal and Popover rendered only their activators and required interaction to be visible. Are the problems outlined around focus in the Modal examples still a concern now that our overlays default to being open
or active
@dpersing ?
Are the problems outlined around focus in the Modal examples still a concern now that our overlays default to being open or active
@chloerice I believe so. I think folks should be able to close the examples and reopen them to see the expected behavior.
Some accidental testing within the Vault and admin shows that if the Modal component appears in a page using the Nav component, focus goes to the "Skip to content" link as part of the modal focus order, which is unexpected. My initial thought that @LauraAubin's work to keep focus from going to the browser chrome should help this. 🤔
Closing this since the last task was completed with https://github.com/Shopify/polaris-react/pull/2555
Issue summary
The Modal component examples have a few accessibility issues that may impact users who rely on Windows High Contrast and/or screen readers, as well as keyboard users:
Focus
X
button or via the esc key, where focus moves is not immediately apparent to the user. Pressing tab after the modal closes causes focus to appear on the control that launched the button, but users will generally expect focus to return to the control that launched the interaction when it closes. (This looks like it should be working in code?)~ (Fixed in https://github.com/Shopify/polaris-react/pull/2140)Semantic structure
<input>
has anaria-labelledby
attribute, but its value doesn't match anid
on the page.~ (Fixed in https://github.com/Shopify/polaris-react/pull/2401)title
is provided, thearia-labelledby
attribute of the modal points to an invalidid
.~ (Fixed in PR https://github.com/Shopify/polaris-react/pull/2115.)The focus issue may also relate to a weird deal with NVDA/Firefox, where the virtual buffer is still able to read the modal content even after it's removed from the DOM. (I tested with NVDA/Chrome as well, just to see what it would do, and it reads as expected.) Examples I've tested where focus goes directly to an onscreen element don't have this issue, since that updates the buffer.
High Contrast support
box-shadow
, which is not visible when the component is viewed in High Contrast. Users may not be exactly sure of the shape and size of the modal, and what it overlays.~ (Fixed in PR https://github.com/Shopify/polaris-react/pull/2114.)Current code
X
button (HTML)Modal container styles (CSS)
Input example (HTML)
Steps to reproduce
Button and label text
High Contrast
Keyboard
Open
button and press return/enter or space to activate it.X
button and activate it.Behavior (tl;dr)
Expected
<input>
elements will have a valid label.Actual
X
button icon has no text equivalent.<input>
has no label.Recommendations
X
button anaria-label
or visually hidden text that conveys its purpose (aria-label="Close modal"
).title
is provided, do not include anaria-labelledby
attribute on the modal.transparent
border so when the border is made a solid color automatically in High Contrast, the edges of the modal are easy to see. If preferred, this can be applied using the-ms-high-contrast
media query, but it shouldn't hurt to just include it normally.See the ARIA authoring practices modal example.
There are a number of enhancements currently available in the 1.1 spec for modals, but support is either not present or buggy at present. We can keep an eye on that progress and add those in time.
X
button recommendation example (HTML)Modal border recommendation example (CSS)
Input label recommendation example (HTML)
Specifications