Aria checkbox question

Dear w3 team,

I’m refactoring our checkboxes according to your suggestion here: https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/examples/checkbox/

and I was wondering, why you don’t use the input HTML element with type=”checkbox”. When implementing accessible buttons all sources I have read until now say to use the button tag, and not a div with onClick events, exactly because it is more accessible, so why now use a div instead of a semantic HTML element?

I’m aware that assigning a role=”button” or a role=”checkbox” is needed, but why not use the HTML element that exists for this reason?

Best regards,
Stephan Haditsch

Received on Tuesday, 11 March 2025 16:15:58 UTC