<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-use-the-tabindex-attribute-zwtiuk0eb" -->

---
title: How-to: Use the tabindex attribute | daily.dev
description: A practical guide explains how to correctly use the HTML tabindex attribute for accessibility. It covers common mistakes such as positive tabindex values,...
canonical: https://daily.dev/posts/how-to-use-the-tabindex-attribute-zwtiuk0eb
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How-to: Use the tabindex attribute | daily.dev
og:description: A practical guide explains how to correctly use the HTML tabindex attribute for accessibility. It covers common mistakes such as positive tabindex values,...
og:url: https://daily.dev/posts/how-to-use-the-tabindex-attribute-zwtiuk0eb
og:image: https://api.daily.dev/og/posts/zwTIuk0eB.png
og:image:alt: How-to: Use the tabindex attribute
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How-to: Use the tabindex attribute

**[Eric Bailey](https://daily.dev/sources/ericwbailey)** · 5 min read · 0 upvotes · 0 comments

## Summary

A practical guide explains how to correctly use the HTML tabindex attribute for accessibility. It covers common mistakes such as positive tabindex values, manually set tab order, and making non-interactive elements focusable, all of which harm keyboard and screen reader users. It then details acceptable uses, including tabindex="-1" for JavaScript-managed widgets, tabindex="0" for scrollable overflow containers (with required ARIA labeling and semantic markup), and cases where no relevant HTML element exists, such as custom listboxes. The guide closes with links to further reading from WebAIM, Google, TPGi, and other accessibility experts.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.a11yproject.com/posts/2021-01-28-how-to-use-the-tabindex-attribute>

## Questions this post answers

### Should I use tabindex values greater than 0 to control tab order?

No. Using tabindex values of 1, 2, 3, etc. forces an element to the front of the keyboard tabbing order, which creates a confusing navigation experience for keyboard users. Instead, rely on the natural reading order of the document and use appropriate interactive elements like a and button, which already support Tab navigation without needing tabindex.

_Developers refining accessible keyboard navigation can find implementation guidance like this on daily.dev._

### When should I add tabindex="0" to a non-interactive element like a div?

Add tabindex="0" to a non-interactive element only when it has CSS overflow applied, making it a scrollable container that needs keyboard access. It also requires a label (via aria-labelledby or aria-label) and a way to convey its semantic role, such as a sectioning element, landmark role, or group role, satisfying WCAG 4.1.2 Name, Role, Value.

_Anyone building scrollable widgets can check accessibility patterns like this while browsing daily.dev._

### Why shouldn't I add tabindex="0" to paragraphs or headings to help screen reader users?

Adding tabindex="0" to non-interactive elements like paragraphs, headings, or lists does not improve screen reader accessibility, despite the common myth. Screen readers already have other expected ways to navigate content. Doing this instead confuses users about what is interactive, adds extra keyboard navigation steps for people with motor control disabilities, and may fail to announce the element's name and role.

_Teams auditing accessibility mistakes like this often compare notes on daily.dev._

## Similar posts on daily.dev

- [A Beginner’s Guide to Manual Accessibility Testing with Keyboard Navigation](https://daily.dev/posts/a-beginner-s-guide-to-manual-accessibility-testing-with-keyboard-navigation-wgi3xgzdt) · SitePoint · 0 upvotes · 0 comments
- [Why Keyboard Users Can’t Scroll Your Overflow Containers](https://daily.dev/posts/why-keyboard-users-can-t-scroll-your-overflow-containers-39v9wmg2j) · CSS-Tricks · 5 upvotes · 0 comments
- [Lost, forgotten, and unfamiliar HTML](https://daily.dev/posts/lost-forgotten-and-unfamiliar-html-gzqwgcxgb) · thoughbot · 75 upvotes · 3 comments
- [Building Better Buttons](https://daily.dev/posts/building-better-buttons-kfg2u6xfq) · Simple Thread · 68 upvotes · 5 comments

---

Tags: [#html](https://daily.dev/tags/html), [#accessibility](https://daily.dev/tags/accessibility)

[View this post on daily.dev](https://daily.dev/posts/how-to-use-the-tabindex-attribute-zwtiuk0eb)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How-to: Use the tabindex attribute","url":"https://daily.dev/posts/how-to-use-the-tabindex-attribute-zwtiuk0eb","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-use-the-tabindex-attribute-zwtiuk0eb"},"datePublished":"2026-09-20T07:43:55.081Z","dateModified":"2026-09-20T07:46:45.833Z","description":"A practical guide explains how to correctly use the HTML tabindex attribute for accessibility. It covers common mistakes such as positive tabindex values,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ba6e8b1aa1a87706643c39ae4bac484b?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ba6e8b1aa1a87706643c39ae4bac484b?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Eric Bailey","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Eric Bailey","logo":"https://media.daily.dev/image/upload/s--r1vwe6z1--/f_auto,q_auto/v1789890198/logos/ericwbailey?_a=BAMAMicg0","url":"https://daily.dev/sources/ericwbailey"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-use-the-tabindex-attribute-zwtiuk0eb","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"html,accessibility","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Eric Bailey","item":"https://daily.dev/sources/ericwbailey"},{"@type":"ListItem","position":3,"name":"How-to: Use the tabindex attribute"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-to-use-the-tabindex-attribute-zwtiuk0eb#faq","mainEntity":[{"@type":"Question","name":"Should I use tabindex values greater than 0 to control tab order?","acceptedAnswer":{"@type":"Answer","text":"No. Using tabindex values of 1, 2, 3, etc. forces an element to the front of the keyboard tabbing order, which creates a confusing navigation experience for keyboard users. Instead, rely on the natural reading order of the document and use appropriate interactive elements like a and button, which already support Tab navigation without needing tabindex. Developers refining accessible keyboard navigation can find implementation guidance like this on daily.dev."}},{"@type":"Question","name":"When should I add tabindex=\"0\" to a non-interactive element like a div?","acceptedAnswer":{"@type":"Answer","text":"Add tabindex=\"0\" to a non-interactive element only when it has CSS overflow applied, making it a scrollable container that needs keyboard access. It also requires a label (via aria-labelledby or aria-label) and a way to convey its semantic role, such as a sectioning element, landmark role, or group role, satisfying WCAG 4.1.2 Name, Role, Value. Anyone building scrollable widgets can check accessibility patterns like this while browsing daily.dev."}},{"@type":"Question","name":"Why shouldn't I add tabindex=\"0\" to paragraphs or headings to help screen reader users?","acceptedAnswer":{"@type":"Answer","text":"Adding tabindex=\"0\" to non-interactive elements like paragraphs, headings, or lists does not improve screen reader accessibility, despite the common myth. Screen readers already have other expected ways to navigate content. Doing this instead confuses users about what is interactive, adds extra keyboard navigation steps for people with motor control disabilities, and may fail to announce the element's name and role. Teams auditing accessibility mistakes like this often compare notes on daily.dev."}}]}
```

