October 30th, 2020

Replying to a tweet from @aardrian

If JavaScript add a role of “button” to the link, would that deal with the expectation issue?

(That would still allow the link to be a fallback for non-JS scenarios.)

51° N , 0° E

Also on Twitter

Reply Retweet Favourite

Responses

Adrian Roselli

Not quite, because now you have to add Space bar support, you are telling non-sighted SR users there is no context menu when there is, and depending on styling or expectation a voice user may have to do a double-step to choose it. Replacing with a <button> is better.

Jeremy Keith

Yes, better for screen reader support where the JavaScript executes, but not so good for any situations—screen reader or otherwise—where JavaScript is unavailable (a link would still work as link). I wish I could handle both scenarios. adactio.com/notes/17579

Adrian Roselli

You can handle both scenarios, but it involves maybe swapping elements and testing with site users. Ideal solutions may vary between sites because of different audience technology profile, skill level, expectation, etc. So less a technical issue than a testing issue.

Jeremy Keith

Ah, right, I see now that you said replacing with an actual button is better than adding a role of “button” to a link—that makes sense! So if JavaScript replaces the links with buttons, I may be on my way to covering both scenarios. adactio.com/notes/17580

Have you published a response to this? :