[docs] Document implementing accessible Popovers
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Steps to reproduce 🕹
Link to live example:
https://codesandbox.io/s/youthful-artem-ycvxvf?file=/src/App.tsx
Steps:
- Enable screen reader (I used NVDA)
- Tab over to button
- Press Enter to open the Popover
- Popover contents not read
Current behavior 😯
Currently, when you open a Popover, its contents are not read by screen readers.
Expected behavior 🤔
The contents of a Popover should be read by screen readers on open
Context 🔦
I was building a pop-over help modal, but I didn't want a full-screen modal.
Popover seems like it should be the right choice, and it behaves broadly as it should including:
- Opening it focuses its contents
- Pressing
Escapefrom withing closes it - Pressing tab cycles through only elements within the Popover
However, screen readers do not correctly read its contents. When the dialog is opened, there is no screen reader feedback so you have no idea a dialog was opened or that your focus was moved into it.
I faffed around for over 2 hours trying to figure out why, and in the end I found out that its because the popover has a role of generic rather than dialog. By setting the role to dialog, opening the popover was announced as a dialog and the contents were read.
Your environment 🌎
npx @mui/envinfo
System:
OS: Windows 10 10.0.22621
Binaries:
Node: 19.4.0 - C:\Program Files\nodejs\node.EXE
Yarn: 3.6.0 - C:\Program Files\nodejs\yarn.CMD
npm: 9.2.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: Not Found
Edge: Spartan (44.22621.1848.0), Chromium (114.0.1823.41)
npmPackages:
@emotion/react: 11.11.0
@emotion/styled: 11.11.0
@mui/base: 5.0.0-beta.4
@mui/core-downloads-tracker: 5.13.4
@mui/icons-material: 5.11.16
@mui/material: 5.13.4
@mui/private-theming: 5.13.1
@mui/styled-engine: 5.13.2
@mui/system: 5.13.2
@mui/types: 7.2.4
@mui/utils: 5.13.1
@types/react: 18.2.8
react: 18.2.0
react-dom: 18.2.0
typescript: 5.0.4
```
Don't forget to mention which browser you used.
Output from `npx @mui/envinfo` goes here.
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox at src/App.tsx and review the Popover accessibility behavior described in the issue. Document how to implement an accessible Popover, including the screen-reader announcement and dialog role behavior. Done means the guidance addresses the reported screen-reader problem and is added to the appropriate documentation location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- accessibility, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100