Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@vfontjr
Last active May 16, 2019 13:56
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 vfontjr/8d321369c2c7251f92a1f6d3b2515fd9 to your computer and use it in GitHub Desktop.
Save vfontjr/8d321369c2c7251f92a1f6d3b2515fd9 to your computer and use it in GitHub Desktop.
Add Keyboard Accessibility to Formidable Forms Collapsible Sections
<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>
<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>
<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>
@vfontjr
Copy link
Author

vfontjr commented Apr 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment