• Home
  • Pricing
  • Free Resources
  • About
  • Docs
  • Support
  • Account

Gravity Wiz

Magically enhanced tutorials, snippets and plugins for Gravity Forms!

  • Gravity Perks
    • Gravity Perks
    • Pricing
  • Blog
    • Free Resources
    • About
  • Support
    • Docs
    • Support
    • Account

Fix Gravity Form Tabindex Conflicts

Avoid the annoying issue where tabbing from a field in one form tabs you to a field in another form. This is caused by conflicting tab indexes.

Last updated February 6, 2023 | Written by David Smith 49 Comments

  • January 2nd, 2014: Updated to fix tabindex issues with forms added via the Gravity Forms widget.

Stop! This method is no longer recommended.

For accessibility reasons, adjusting the tabindex for Gravity Forms should be avoided. Giving the form priority over other interactive content is detrimental to users that rely on keyboard navigation.

  • More info
Gravity Forms 2.3 removes the tabindex property by default. Unless a custom tabindex is specified, this fix will no longer be needed.

This is most common when loading a Gravity Form on a page which is loading a non-GF form (like the WordPress comment form). You’re typing away on your Gravity Form and tab to the next field. Awesome. Except the next field is a completely different form. This snippet sets the starting index of your Gravity Form inputs ridiculously high so such conflicts never happen again.

{Gist removed. This article has been deprecated.}

How do I install this snippet?

Easy peasy. Just copy and paste the code above into your theme's functions.php file.

How to I use this functionality?

This snippet is plug-n-play. No changes needed (unless you’re still seeing tabindex conflicts which is highly unlikely). If you are, just update the 1000 in the snippet to a higher number until the conflict disappears.

Filed Under: Deprecated

Comments

  1. Amanda says

    February 22, 2018 at 7:39 pm

    Hi, I tried this code and it worked great. However, it screws up wherever I use dynamic lists.

    I’m using this plugin: https://wordpress.org/plugins/list-field-number-format-for-gravity-forms/

    Whenever you click the (+) to add another list item, the tab indexes are cloned from the previous line. So, instead of tabbing you from field A, to b, to c, all the way to the end of a line, it tabs you to all the fields listed in column a, then column b, then c, etc. Not an ideal situation. Is there a way to fix?

    Reply
    • David Smith says

      March 6, 2018 at 5:37 pm

      Unfortunately, this is something that you would need to work with the plugin developer on. :/

  2. Jon Jennings says

    March 16, 2017 at 8:43 pm

    Thanks for the reply David. That makes perfect sense now.

    I did then look at it & wonder if you could actually hook into a hook that was already firing. But I added some debug in there and sure enough we do get called twice… the first time on the ‘all forms’ hook with a form ID and then the second time into the form-specific hook without a form ID.

    Thanks again for you help

    Reply
    • David Smith says

      March 16, 2017 at 9:46 pm

      Glad to help, Jon. :)

  3. Jon Jennings says

    March 3, 2017 at 5:50 am

    I love this and it works great – thank you.

    I’m a bit unclear about why we need the if() clause though.

    I see that we register against the GF hook for setting the tab index and we return the greater of 1000 or the global GF tab index.

    But the if() clause seems to say that, if you’ve come here with a reference to a specific form, then register an additional hook for just that form to call this same function.

    But we’ve already got this hooked function which is registered against ALL forms – so why the need to register another hook for one specific form? And it’s clear that this existing hook is triggered correctly for that specific form already – given that we’re in the function right now.

    Does that question make sense? Seems to me that you could get away without the if() and the extra add_filter() that it executes.

    Reply
    • David Smith says

      March 3, 2017 at 8:02 am

      You are free to remove this. What it does is provides an additional layer of specificity which gives the filter more “authority” to override tabindexes set in user error.

  4. Kevin says

    August 31, 2016 at 12:23 am

    many many thanks! worked like a charm. truly appreciate your time in providing this useful tool at no cost. god bless.

    Reply
    • David Smith says

      August 31, 2016 at 12:44 am

      Glad to help, Kevin. :)

  5. Mark Lee says

    August 16, 2016 at 3:02 pm

    This worked great and is 2 years old… Why has gravity forms still not implemented this…???

    Reply
    • David Smith says

      August 16, 2016 at 3:05 pm

      The short answer is, it’s complicated. GF has a very large user base. Even small changes can create big problems. Glad you found this useful. :)

  6. Jon says

    May 27, 2016 at 4:10 pm

    Perfect! Thank you!

    Reply
  7. Cheyne says

    May 2, 2016 at 6:39 pm

    Thank you, fixed my problem exactly!

    Reply
  8. vrajesh says

    April 29, 2016 at 12:36 am

    Thanks for sharing..! Awesome.

    Reply
    • David Smith says

      April 29, 2016 at 5:17 pm

      My pleasure, glad it helped you. :)

« Older Comments

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.

Recent Posts

  • Our 46th perk is here. Say hello to Advanced Save & Continue.
  • Introducing Page Transitions 1.0 ๐Ÿ“–
  • Gravity Forms QR Code turns 1.0 ๐ŸŽ‰
  • How to Filter One Field By Another and Create Gravity Forms Chained Selects
  • Gravity Forms OpenAI

Categories

  • How To (78)
  • News (25)
  • Plugins (21)
  • Releases (19)
  • Resource (4)
  • Snippets (54)
  • Spotlights (18)
  • Tutorials (58)
  • Updates (177)

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 2023 ยท Powered by WordPress ยท Gravity Wiz LLC

  • Support
  • Affiliates
  • About
  • Sitemap
  • Terms & Conditions of Use
  • Privacy Policy
  • Cookies Policy