How to Fix Positive tabindex Values for Keyboard Users

A positive tabindex (tabindex="1", "2", etc.) forces an element to the front of the keyboard Tab order, ahead of everything else on the page. By the end of this guide you will have found every positive tabindex on your site, replaced it with 0, -1 or nothing, and confirmed that Tab moves through the page in the order people read it.

By Updated ⏱ 15-30 minutes🎯 Beginner● Low impactAccessibility
Illustration: No positive tabindex fix guide
ACCESSIBILITY · FIX GUIDE No positive tabindex IMPACTEFFORT TIME15-30 minutes LEVELBeginner

Why it matters

Keyboard and screen reader users move through a page with Tab. A positive tabindex makes focus jump to an element out of reading order, such as a footer newsletter field before the main menu. 3 Focus Order.

Automated checkers such as axe-core flag any tabindex above 0 as a best-practice failure. The ranking impact is small, but the fix usually takes minutes and removes a real barrier for keyboard visitors.

✕Before<input type="email" name="newsletter"tabindex="1"> in the footer grabsfocus before the site logo and main✓After<input type="email" name="newsletter">receives focus in its natural place,after everything above it in the DOM.

What you need

Access to your theme, template or component source files
A desktop browser with DevTools (Chrome, Edge or Firefox)
The axe DevTools extension or Lighthouse (optional, for verification)
A keyboard to test Tab navigation

Step-by-step fix

1

List every positive tabindex on the live page

Open the flagged page and open DevTools with F12, then go to the Console tab. Run the snippet below. It outlines each offending element in red and lists it with its tabindex value.

Note which template, widget or plugin each element comes from.

javascript
[...document.querySelectorAll('[tabindex]')].filter(el => parseInt(el.getAttribute('tabindex'), 10) > 0).forEach(el => { el.style.outline = '3px solid red'; console.log(el.getAttribute('tabindex'), el); });
Pro tip: Repeat on your key templates: home, product or article, contact form and checkout. Positive tabindex values often live in a single shared header, footer or form widget.
2

Find the source in your code

Search your theme or project files for positive tabindex values. The pattern below matches tabindex="1" through "9999" in HTML and JSX, but not 0 or -1. If nothing matches, the attribute is probably injected by a plugin, app, form builder or third-party script.

Check those settings instead.

text
grep -rnE 'tab[iI]ndex=["{]?["]?[1-9][0-9]*' ./src ./templates ./wp-content/themes
Pro tip: Also search for JavaScript that sets the attribute, such as setAttribute('tabindex', '1') or element.tabIndex = 2.
3

Remove the attribute from native focusable elements

Links with href, buttons, inputs, selects and textareas are already focusable. For these, delete the tabindex attribute entirely. Do not change it to 0, because it is not needed.

html
<!-- Before -->
<a href="/contact" tabindex="3">Contact</a>
<input type="search" name="q" tabindex="1">

<!-- After -->
<a href="/contact">Contact</a>
<input type="search" name="q">
4

Use tabindex="0" or "-1" for custom widgets

Some elements that are not natively focusable still need focus:

  • A div or span acting as a control should use tabindex="0". This puts it in the natural Tab order. Give it a role and keyboard handlers too.
  • An element you only focus with a script, such as a modal heading or a skip-link target, should use tabindex="-1".

Better still, replace clickable divs with a real button.

html
<!-- Custom control: natural order -->
<div role="button" tabindex="0" aria-pressed="false">Show filters</div>

<!-- Better: native element, no tabindex needed -->
<button type="button" aria-pressed="false">Show filters</button>

<!-- Programmatic focus target -->
<main id="main" tabindex="-1">...</main>
Pro tip: React's tabIndex prop follows the same rules. Use tabIndex={0} or tabIndex={-1}, never a number above 0.
5

Fix the order by moving markup, not tabindex

If someone added positive values to make focus follow a layout, fix the source order instead. Put the HTML elements in the order they should be read, then use CSS such as flex, grid or the order property to position them visually. Keep visual and DOM order closely aligned, because a large mismatch also fails Focus Order.

6

Deploy, clear caches and re-test

Publish the change. Then purge your page cache, CDN cache and any minification plugin cache. Reload the page, re-run the Console snippet from step 1 and confirm it logs nothing.

Finally, click the address bar and press Tab repeatedly. Focus should go from top to bottom, left to right, with no jumps.

Pro tip: Press Shift+Tab to confirm the reverse order is also logical.

Platform-specific notes

WordPress

Positive tabindex values usually come from the theme's header.php or footer.php, or from form plugins. Older Gravity Forms setups had a 'tabindex' filter, so check for a gform_tabindex filter in functions.php and set it to return false. Edit through a child theme, not the parent theme.

Shopify

Go to Online Store > Themes > ⋯ > Edit code and search the sections, snippets and layout/theme.liquid files for tabindex. If an app adds the attribute, such as a popup or review widget, the code is not in your theme. Contact the app developer or change the app's settings.

Wix

You cannot edit tabindex on standard Wix elements. Use Settings > Accessibility Wizard and arrange elements top to bottom in the editor, since Wix derives Tab order from the layout. Positive values usually come from Custom Embed HTML or Velo code, so remove them there.

Webflow

Select the element, then open Element Settings (the gear icon) > Custom Attributes. Delete any tabindex attribute with a value above 0. Also check Embed elements and custom code under Site Settings > Custom Code.

React / Next.js

Search for tabIndex={ with values above 0. The eslint-plugin-jsx-a11y rule 'jsx-a11y/tabindex-no-positive' catches these at build time. Turn it on as an error so the problem cannot come back.

Check that it worked

✅ How to verify

  • Run axe DevTools or Lighthouse (DevTools > Lighthouse > Accessibility). Confirm 'Elements should not have tabindex greater than zero' no longer appears.
  • Re-run the Console snippet from step 1. It should log nothing and add no red outlines.
  • Tab through the page from the address bar. Focus should follow visual reading order, starting with the skip link or logo.
  • Re-run your site audit and confirm the 'No positive tabindex' check passes on all templates.

⚠️ Common mistakes

  • Changing tabindex="1" to tabindex="0" on links and buttons that are already focusable. It is harmless but unnecessary, so remove the attribute instead.
  • Setting tabindex="-1" on interactive controls users need to reach. This removes them from keyboard access entirely.
  • Fixing only the theme file while a plugin, app or embedded script keeps injecting the attribute at runtime.
  • Forgetting to purge the CDN or page cache, so the audit still sees the old HTML.

Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.

Check my site free

FAQ

Is tabindex="0" bad for accessibility?

No. tabindex="0" adds an element to the Tab order in its natural DOM position, which is correct for custom interactive widgets. Only values above 0 cause problems.

What is the difference between tabindex 0 and -1?

tabindex="0" makes an element reachable with the Tab key in source order. tabindex="-1" keeps it out of the Tab order but lets scripts focus it with element.focus(). Use -1 for modal containers or skip-link targets.

Does a positive tabindex affect SEO rankings?

Not directly. Search engines do not rank on tabindex. It does lower your Lighthouse accessibility score and makes the site harder to use for keyboard visitors.

How do I make focus go to my search box first without tabindex="1"?

Move the search box earlier in the HTML, for example into the header, or add a skip link that points to it. You can also use the autofocus attribute sparingly on pages where search is the main task.