In short
Custom toggles built with role="switch", checkbox, radio or menuitemcheckbox need a name, or users hear only "switch, off." Add aria-label or link a visible label. Weight 7.
<button role="switch" aria-checked="false" aria-label="Dark mode"></button>
This guide isn't affiliated with or endorsed by Google.
Related issues
Sources and references
Chrome for Developers, Lighthouse accessibility score
MDN, ARIA: switch role

About the author
Nazmul Nikhil
Head of SEO & Assistant Manager, Digital Marketing at Notionhive
SEO and AI search consultant in Dhaka, Bangladesh, helping small and mid-size businesses in the USA, UK, Australia and Canada.



