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.

-----Original Message-----
From: WebAIM-Forum < <EMAIL REMOVED> > On Behalf Of glen walker
Sent: Wednesday, August 12, 2020 12:16
To: WebAIM Discussion List < <EMAIL REMOVED> >
Subject: Re: [WebAIM] Do Web developers tend to dislike the button element?

Most developers are lazy (I'm one), although "efficient" is probably a better term than "lazy". I will always use code that's simpler and that typically means using a button. However, if I had code that used a <span> for a button and I copy/paste that code to my new page rather than writing a button from scratch, that would be one reason it keeps propagating. But I wouldn't intentionally change a real button to a span button.

On Wed, Aug 12, 2020 at 1:09 PM < <EMAIL REMOVED> > wrote:

> My credit union has had a fairly accessible Web site for several
> years. So, I was surprised recently when a site update included
> replacing the login button with a span "button" that was inaccessible.
> They fixed this after I complained, but it once again got me to
> wondering why so many developers like to use a span for this. Aside
> from accessibility concerns, it seems like the button element is less work for the developer.
>
> So, why do span buttons refuse to die? Is it that developers have some
> dislike of buttons elements?
>
> Jeff Gutsell
>
> > > https://urldefense.com/v3/__http://list.webaim.org/__;!!C5qS4YX3!T3b1W
> TLFdW-UUg2XsCyZTEMWduoI2rsvVf3xe4ROYRvY55iE_DY9Ejc9ZCIXuvvEMA$
> List archives at
> https://urldefense.com/v3/__http://webaim.org/discussion/archives__;!!
> C5qS4YX3!T3b1WTLFdW-UUg2XsCyZTEMWduoI2rsvVf3xe4ROYRvY55iE_DY9Ejc9ZCJ8P
> 3y98A$ >