You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@0xTheProDev, thanks for submitting the issue! There are certainly more ways to approach this (as it is with many things in accessibility!). This button uses the approach of Hidde de Vries which was recently updated thanks to @garyb1#68. 🙂
In this case, we're using a standard button element, which exists in HTML. But there is one detail about it that doesn't exist in HTML, which is that this is the type of button that toggles. We can add this by setting the aria-pressed with a "true" or "false" value.
This brings a known benefit to end users, specifically to users of screenreaders, who will now hear this is a toggle button. For toggle buttons, it is important that the content doesn't change. As the button text, I have used “Toggle dark mode”.
https://github.com/markteekman/accessible-astro-components/blob/ea8f2426c38607b61f7e99c203513eaaf47a61f4/DarkMode.astro#L5
Should this button have
switch
role?The text was updated successfully, but these errors were encountered: