Add Keyboard Accessibility to Formidable Forms Collapsible Sections
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="frm_field_[id]_container" class="frm_form_field frm_section_heading form-field[error_class]"> | |
<h3 class="frm_pos_[label_position][collapse_class]" tabindex="0">[field_name]</h3> | |
[if description]<div class="frm_description">[description]</div>[/if description] | |
[collapse_this] | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="frm_field_[id]_container" class="frm_form_field frm_section_heading form-field[error_class]"> | |
<h3 class="frm_pos_[label_position][collapse_class]">[field_name]</h3> | |
[if description]<div class="frm_description">[description]</div>[/if description] | |
[collapse_this] | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
jQuery(document).ready(function ($) { | |
"use strict"; | |
$('h3.frm_trigger').on("keydown", function() { | |
/* Enter & Space are required for Safari, the Chromium based MS Edge, and Chrome. Firefox works with key codes */ | |
if ( event.which == 'Enter' || event.which == 'Space' || event.which == 13 || event.which == 32 ) { | |
event.preventDefault(); | |
$(this).click(); | |
} | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code is for Keyboard Accessibility & Formidable Forms Collapsible Sections