Snippets: Enable Tabindex for Visual Composer FAQ Toggle Modules

IMPORTANT: This function is already built-into Total 4.5+

// Open toggle on focus
function myprefix_vc_toggle_tabindex() { ?>

	<script>
		( function( $ ) {
			'use strict';
			$( document ).on( 'ready', function() {
				var $toggles = $( '.vc_toggle' )
				$toggles.each( function() {
					var $this = $( this );
					$this.attr( 'tabindex', 0 );
					$this.focus( function() {
						$( '.vc_toggle_active' ).each( function() {
							var $el = $( this );
							$el.find( '.vc_toggle_content' ).slideUp( {
								duration: 300,
								complete: function () {
									$el.removeClass( 'vc_toggle_active' );
								}
							} );
						} );
						$( this ).find( '.vc_toggle_title' ).trigger( 'click' );
					} );
				} );
			} );
		} ( jQuery ) );
	</script>

<?php }
add_action( 'wp_footer', 'myprefix_vc_toggle_tabindex' );
All PHP snippets should be added via a child theme's functions.php file.