docusaurus: a11y: light & dark mode checkbox doesn't announce state switches
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I’m using the latest version of Docusaurus.
- I have tried the
npm run clearoryarn clearcommand. - I have tried
rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages. - I have tried creating a repro with https://new.docusaurus.io.
- I have read the console error message carefully (if applicable).
Description
Following up from #6665: The color mode toggle now does correctly indicate what its state is with its label. But, when you activate it while using a screenreader, nothing narrates that it switched.
Discussed on stream with @BenDMyers on Twitch: https://www.twitch.tv/videos/1498962341.
Reproducible demo
Steps to reproduce
- Activate a screenreader such as NVDA or VoiceOver
- <kbd>Tab</kdb> over to the light/dark mode toggle
- Press <kbd>Enter</kbd> to trigger it
Expected behavior
There should be a narration, such as what’s provided by aria-pressed.
See more here: https://sarahmhigley.com/writing/playing-with-state
Actual behavior
No narration.
Your environment
- Public source code: https://github.com/typescript-eslint/typescript-eslint
- Public site URL: https://typescript-eslint.io/
- Docusaurus version used: 2.0.0-beta.21
- Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome 102
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): Windows 10
Self-service
- I’d be willing to fix this bug myself.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (5 by maintainers)
Commits related to this issue
- fix: Announce theme switches when using screen reader. #7667 — committed to mturoci/docusaurus by mturoci 4 years ago
- fix(theme): announce theme switches when using screen reader. #7667 (#8174) Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com> — committed to facebook/docusaurus by mturoci 4 years ago
- fix(theme): announce theme switches when using screen reader. #7667 (#8174) Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com> — committed to facebook/docusaurus by mturoci 4 years ago
A JS-less accessible tooltip would definitely be an improvement.
I can’t suggest swapping aria-label and title, I was just sharing that information so you were clear on which aspects of the UX each controlled in this scenario.
Some usability testing with disabled folks would be a great way to hone the control, but I know that’s probably not realistic in this case. I’d point you towards some public usability data for this type of control, but I’m unfortunately not aware of any. It seems like an emerging UI pattern, a tri-state icon button to control light/dark theme. I’m struggling to think of where I’ve seen other tri-state buttons on the web.