←back to thread

Just use a button

(gomakethings.com)
284 points moebrowne | 1 comments | | HN request time: 0.217s | source
Show context
bugsliker ◴[] No.45774539[source]
- tabindex=0 doesn’t affect ordering, does it?

- why do you need to listen for events at the document level?

not that i disagree with the article, but some arguments didn’t seem right.

replies(2): >>45774646 #>>45774711 #
thyristan ◴[] No.45774646[source]
> - tabindex=0 doesn’t affect ordering, does it?

Of course it does. tabindex=0 doesn't sort naturally into the automatic tabindex order, it sorts AFTER everything. So you are jumping through all the other tabindex elements, then you are jumping back to all tabindex=0.

replies(4): >>45774767 #>>45774845 #>>45775649 #>>45777072 #
1. bugsliker ◴[] No.45775649[source]
I'm saying tabindex=0 is naturally sorted wrt other naturally focusable elements. That matches the behavior of the <button> you're trying to emulate. I don't know what tabindex>0 has to do with this.

See this fiddle https://jsfiddle.net/483uqjnp/

(again, I do not condone building your own <button>, just pointing this out)