-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
a11y: light & dark mode checkbox doesn't announce state switches #7667
Comments
I'm not sure how we are to fix this. |
The button itself probably shouldn't receive |
Yes, but our button is light/dark instead of dark/not dark, so pretty sure that's not |
@Josh-Cena I would like to work on this issue if no one else is already working on it. |
@noobyogi0010 Since it hasn't had any activities in the last month, you can assume no-one is working on it and just go ahead. |
@Josh-Cena Okay, I'll get started with it. |
@Josh-Cena I used |
I think there's an issue with our accessibility fix. When we navigate from one page to another, triggering a global layout unmount/remount (ie navigating from homepage to docs or to blog), the dark mode switch will announce itself on navigation. We should probably only make it announce after having been pressed once no? |
@slorber after a bit of investigation I found out that The question is why is the ThemeToggle button reinserted on the navigation. From my quick look into the code, it seems like the whole page is wrapped within react-router. The problem with this approach is that it tears down everything and builds an entirely new tree from the ground up - remounts. This includes layout, nav, and footer despite the content being the only one that needs a real remount. The rest of the components would be fine with just an update. Wrapping just the content part within the react-router would not only solve the issue that you mentioned but could also prevent a lot of bugs in the future + is a nice perf improvement. Note that the above proposal is a bit naive and doesn't account for any hidden problems that may have led to the current architecture which I would like to learn more about. |
@mturoci the unmount/remount problem is a known problem (#2891) and not so simple to solve in the short term. I'm more looking for a solution considering we won't be able to fix this deeper problem immediately. The layout should not automatically be applied to all Docusauurus routes: some sites need to have pages with a different layout. And there can also be multiple layout levels (see docs or blog). We should have support for nested routes (like Remix, and soon Next.js have). I think only adding |
Another problem with the accessibility fix is that the screen reader will continue to announce that the page is in dark mode or light mode for five or six times if the user does not move away from the light/dark mode button. I am able to reduce the announcements to two times if I remove aria-live="polite" from the web inspector. I expected the states to be announced one time on change only. |
I'm not sure to understand. By chance are you able to record a video or something that could make it clearer? What do you mean by "move away from the region" |
By moving away, I mean focusing the screen reader on another part of the screen. By region, I meant the light/dark mode button. |
Here's a video. I hope this makes it clearer: Docusaurus_screenreader_color_mode_demo.mp4 |
Is this issue still open? |
@JoshuaKGoldberg i would like to work on this .Is there anyone working on it or would you assign it to me |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.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
https://typescript-eslint.io
Steps to reproduce
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
Self-service
The text was updated successfully, but these errors were encountered: