Jump to main navigation, main content

Archived entry | Matt Wilcox .net

Making Elements Focusable with Tabindex

Jonathan Snook tells us how to make arbitrary elements keyboard accessible using a clever aspect of the tabindex attribute.

Comments

skip to comment form
  1. Matt Wilcox posted 42min, 27sec after the entry and said:

    Beware - the first part of the trick (value of -1) is invalid HTML.

    From the HTML spec: "This value must be a number between 0 and 32767"

    I would imagine this is why the element given a tabindex of -1 is not focusable; because it's an invalid value. Programmatic access wouldn't care if the value of the attribute was valid or not though, which would be why you can access it through JavaScript.

    What happens if you leave the value blank? Would that emulate the action of a -1 value, or a zero? Would it even be valid code?

From the archives

Other enteries filed under:

Of The Moment

Site information

Built with valid XHTML and CSS, designed with web standards and accessibility in mind. Best viewed in a modern browser [Firefox, Safari, Opera]

This domain and all content is a copy of my old website, for historical purposes only.