WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Do Web developers tend to dislike the button element?

for

From: Jeremy Echols
Date: Aug 12, 2020 2:03PM


I'm extremely lazy myself, and I tend to just argue against the use of "custom widget" types of buttons. Because not only are they hard to make accessible, but they're extra work to make them clickable in the first place. A button just works as is.

If I had to guess, I'd say perhaps as Glen suggests it's a copy and paste issue. If not, maybe it's a JS framework that attaches lots of behaviors to custom elements, and is behind the times, so it just tosses spans everywhere and uses classes and data attributes to implement functionality. A third possibility is that the dev discovered some crazy CSS trick that seemed difficult to implement on a button, so they coded a span element instead.

I guess there are a variety of reasons why a developer might do this... but every reason I can think of seems pretty iffy even if a dev doesn't know anything about accessibility.