HTMHell icon indicating copy to clipboard operation
HTMHell copied to clipboard

<a> isn't tabbable to unless it has the href attribute

Open oczki opened this issue 11 months ago • 1 comments

The entry #25 A link is a button is a link contains the following text:

You don’t need the tabindex attribute if you use an a tag. HTML hyperlinks are focusable by default.

This is not completely correct. The a element is only tabbable to if it has the href attribute. Without href, the a element can't be tabbed to by default.

You can try tabbing to the elements in this list and see that the 3rd element doesn't receive focus:

  • <a href=#">Element 1</a>
  • <a href>Element 2</a>
  • <a>Element 3</a>
  • <a href>Element 4</a>

oczki avatar Dec 07 '24 18:12 oczki

I mean it says "hyperlinks", but fair enough. :) Do you want to make the changes and submit a pull request?

matuzo avatar Dec 09 '24 12:12 matuzo