Index: functions.php =================================================================== --- functions.php (revision 25007) +++ functions.php (working copy) @@ -142,6 +142,11 @@ */ wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '1.0', true ); + /* + * Adds JavaScript for toggling the sub-menu when :focus an anchor in a wp_nav_menu + */ + wp_enqueue_script( 'twentytwelve-nav-menus', get_template_directory_uri() . '/js/nav-menus.js', array( 'jquery' ), '1.0', true ); + $font_url = twentytwelve_get_font_url(); if ( ! empty( $font_url ) ) wp_enqueue_style( 'twentytwelve-fonts', esc_url_raw( $font_url ), array(), null ); Index: js/nav-menus.js =================================================================== --- js/nav-menus.js (revision 0) +++ js/nav-menus.js (revision 0) @@ -0,0 +1,21 @@ +/** + * nav-menus.js + * + * Handles toggling the sub-menu on the anchor focus (Accessibility) + */ +( function( $ ) { + $( 'li.menu-item a' ).on({ + focus : function( e ) { + if( $( this ).parents( 'li' ).find( '> ul' ) ) { + $( this ).parents( 'li' ).find( '> ul' ).each( function() { + $( this ).show(); + }); + } + }, + focusout : function( e ) { + if( $( this ).parents( 'li' ).find( '> ul' ).is( ':visible' ) ) { + $( this ).parents( 'li' ).find( '> ul' ).css( 'display', '' ); + } + } + }); +} )( jQuery ); \ No newline at end of file