Description
This filter is executed before the first field is displayed on the form. It can be used to change the tabindex start value or to disable the tabindex attribute.
Accessibility Impacts
Please note that changing the tabindex has accessibility implications. You can unintentionally upset the logical tabindex order determined by the browser when the page is loaded which can affect usability.
If your goal is to meet required accessibility guidelines, we highly discourage the use of this filter and recommend letting the user’s browser determine the tabindex of your page.
Usage
Applies to all forms.
add_filter( 'gform_tabindex', '__return_false' );
Applies to a specific form. In this case, form Id 5.
add_filter( 'gform_tabindex_5', '__return_false' );
Parameters
- $tabindex string
The current tabindex. -
$form Form Object
The current form.
Examples
This example changes form 10’s tabindex start value to 4
add_filter( 'gform_tabindex_10', 'change_tabindex' , 10, 2 ); function change_tabindex( $tabindex, $form ) { return 4; }
This example disable tabindex for all forms
add_filter( 'gform_tabindex', '__return_false' );
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFFormDisplay::get_form() in form_display.php