Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Dark Mode Button - Changing accessible name #68

Closed
garyb1 opened this issue Dec 6, 2023 · 0 comments · Fixed by #69
Closed

Dark Mode Button - Changing accessible name #68

garyb1 opened this issue Dec 6, 2023 · 0 comments · Fixed by #69

Comments

@garyb1
Copy link
Contributor

garyb1 commented Dec 6, 2023

As it stands the button toggles from aria-pressed="false" and aria-label="Enable dark mode" to aria-pressed="true" and aria-label="Disable dark mode" but we should not change the accessible name content.

References:

  1. Hidde De Vries How I built a dark mode toggle

For toggle buttons, it is important that the content doesn't change. As the button text, I have used “Toggle dark mode”. If we would update the label of the button from “Turn on light” to “Turn on dark”, we kind of have a toggle (as MDN suggests), but that way, it wouldn't be recognised by the browser and set in the accessibility tree to be a toggle, and, because of that, not announced as a toggle by screenreaders.

Resolution:
Leave the aria-label as "Toggle Dark Mode"

garyb1 added a commit to garyb1/accessible-astro-components that referenced this issue Dec 6, 2023
garyb1 added a commit to garyb1/accessible-astro-components that referenced this issue Dec 6, 2023
markteekman added a commit that referenced this issue Dec 10, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant