3 ms·
I disagree that 'if something is supposed to be clickable, it should always be a button.' Anchor elements are easy shortcuts for interactive element in text. I
by grenoire 6y ago
I disagree that 'if something is supposed to be clickable, it should always be a button.'
Anchor elements are easy shortcuts for interactive element in text. If you aren't using it already, try `tabindex=0` which enables mouse clicking, keyboard focusing, and special styling through CSS; all without messing your URL anchors.
- reificator 6y agoPower users are likely to be annoyed when middle clicking your link opens a new worthless tab instead of doing what they wanted to do. Less knowledgeable users already have a hard enough time distinguishing what is clickable and what causes navigation, swapping functionality around on them is not kind. Styling can overcome this one to be fair. And of course as the article states, using the wrong thing makes it harder for screen readers and other such technologies to help users use your page. If that's not enough to convince you, I offer you a challenge. Use a screen reader for a week to get a feel for how to use it. Then use nothing but a screen reader for a week, no looking at your screen at all for even a moment. If you get through that without being frustrated by decisions exactly like these, I'll take you much more seriously.
- gostsamo 6y agoUnfortunately, nobody using a screen reader uses tabulation to navigate a page because it is slow and painful process. So, you might hide the element from the tabbing sequence, but it will show in browsing mode. Just tried it in MDN.
- grenoire 6y ago`tabindex=0` actually does something else than (what I understand) you think it does. Normally an <a> element can only be clicked+focused if it has a href or a tabindex. A tabindex of 0 will make it clickable+focusable, without having a href on it, making it behave like a button. It doesn't make it unclickable/untabbable, simply an alternative to href without a # (as an empty href will also not be clickable).
- gostsamo 6y agoStill on the MDN example. The browsing mode reads the nont-tabbable element but when I try to focus it with object navigation, it says unknown. However, if I move to it from the previous object it reads the text but still does not interact. I'm not sure what would happen if the element is an anchor but I'd bet on "WTF is this supposed to do".