3 ms·
While I agree semantically use of <button> can be clearer, clickable divs can still play largely fine with most accessibility technologies if ARIA attributes ar
by giobox 7y ago
While I agree semantically use of <button> can be clearer, clickable divs can still play largely fine with most accessibility technologies if ARIA attributes are used.
Does it semantically make the most sense? Not necessarily, but it isn't a blocker to most accessibility tools and use and support for ARIA attributes is pretty widespread nowadays, including all of the major browsers and screen readers.
> https://developers.google.com/web/fundamentals/accessibility/semantics-aria/ https://developers.google.com/web/fundamentals/accessibility...
> https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Web_applications_and_ARIA_FAQ https://developer.mozilla.org/en-US/docs/Web/Accessibility/A...
- ricardobeat 7y agoNumber of times I remember seeing an an app using `<div onclick>` with proper aria attributes: 0.
- deleted 7y ago[deleted]
- giobox 7y agoIt's often a legal or contractual requirement when selling software to public bodies in many countries, so I've seen it used a lot. Mileage may vary in other markets. The important point is that fundamentally using a <div> in place of <button> can still be made to work easily with these accessibility tools - many comments here imply it can't be done at all and only a button will work. Does it semantically make sense? Likely no, but it isn't a hard blocker on accessibility.
- mosdl 7y agoReinventing the wheel is bad