Skip to content

Commit 57cfae0

Browse files
committed
fix: focus styles not working after window resize from mobile to desktop
1 parent 303cc00 commit 57cfae0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/wp-content/themes/twentyfourteen/js/functions.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,15 @@
107107
return;
108108
}
109109

110+
// Remove existing handlers to avoid duplicates.
111+
navMenus.find( 'a' ).off( 'focus.twentyfourteen blur.twentyfourteen' );
112+
113+
// Add focus handlers.
114+
navMenus.find( 'a' ).on( 'focus.twentyfourteen blur.twentyfourteen', function() {
115+
$( this ).parents().toggleClass( 'focus' );
116+
} );
117+
110118
if ( 783 > _window.width() ) {
111-
$( '.primary-navigation, .secondary-navigation' ).find( 'a' ).on( 'focus.twentyfourteen blur.twentyfourteen', function() {
112-
$( this ).parents().toggleClass( 'focus' );
113-
} );
114119
if ( 'ontouchstart' in window ) {
115120
$( document.body ).off( 'touchstart.twentyfourteen' );
116121
}

0 commit comments

Comments
 (0)