HTML

Chapter 36: Tabindex

ValueMeaning
negativeelement will be focusable, but it should not be reachable via sequential keyboard navigation
0element will be focusable and reachable through keyboard sequential navigation, but it’s relative order is
defined by the platform convention
positiveelement must be focusable and accessible via sequential keyboard navigation; it’s relative order will be
defined by the attribute value: the sequential follow the increasing number of the tabindex

Add an element to the tabbing order

<div tabindex="0">Some button</div>

Note: Try to use a native HTML button or an a tag where appropriate.

Remove an element from the tabbing order

<button tabindex="-1">This button will not be reachable by tab</button>

The element will be removed from the tabbing order but will still be focusable.

<div tabindex="2">Second</div>
<div tabindex="1">First</div>

Positive values will insert the element at the tabbing order position of its respective value. Elements without
preference (i.e. tabindex=”0″ or native elements such as button and a) will be appended after those with
preference.

Positive values are not recommended as they disrupt the expected behavior of tabbing and might confuse people
who rely on screenreaders. Try to create a natural order by rearranging your DOM structure.

Recent Posts

Unlocking the Secrets of JSON.stringify(): More Than Meets the Eye

JSON (JavaScript Object Notation) is a lightweight data-interchange format widely used in web development. At…

3 months ago

How to Handle AJAX GET/POST Requests in WordPress

AJAX (Asynchronous JavaScript and XML) is a powerful technique used in modern web development that…

4 months ago

Page Speed Optimization: Post-Optimization Dos and Don’ts

Introduction After successfully optimizing your website for speed, it's essential to maintain and build upon…

4 months ago

Ultimate Guide to Securing WordPress Folders: Protect Your Site from Unauthorized Access

Securing your WordPress folders is crucial to safeguarding your website from unauthorized access and potential…

5 months ago

HTML CSS PHP File Upload With Circle Progress Bar

Creating a file upload feature with a circular progress bar involves multiple steps. You'll need…

5 months ago

Using WP Rocket with AWS CloudFront CDN

Integrating WP Rocket with AWS CloudFront CDN helps to optimize and deliver your website content…

5 months ago