Skip to content

Instantly share code, notes, and snippets.

@coccoinomane
Last active March 29, 2016 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coccoinomane/31b7e1a2d874dc41d4a6 to your computer and use it in GitHub Desktop.
Save coccoinomane/31b7e1a2d874dc41d4a6 to your computer and use it in GitHub Desktop.
<?php
/*
#########################################################
---------------------------------------------------------
-- Fix tabindex in Gravity forms
---------------------------------------------------------
#########################################################
*/
/**
* Prevent the focus to jump outside of a Gravity form upon
* pressing tab.
*
* Install this snippet in your theme's functions.php.
*
* This is David Smith's script at: http://gravitywiz.com/
* fix-gravity-form-tabindex-conflicts/
* Thank you David for sharing!
*
* Last version: https://gist.github.com/31b7e1a2d874dc41d4a6
*/
add_filter( 'gform_tabindex', 'gform_tabindexer', 10, 2 );
function gform_tabindexer( $tab_index, $form = false ) {
$starting_index = 1000; // if you need a higher tabindex, update this number
if( $form )
add_filter( 'gform_tabindex_' . $form['id'], 'gform_tabindexer' );
return GFCommon::$tab_index >= $starting_index ? GFCommon::$tab_index : $starting_index;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment