From 0acb4ebc35f933585ec2c649ce07497f3c4c7f58 Mon Sep 17 00:00:00 2001 From: laurelfulford Date: Fri, 21 Dec 2018 21:08:56 +0000 Subject: [PATCH] Twenty Nineteen: Make sure links are followed on touchend, not touchstart. The theme's original navigation JavaScript was making it so all links on a site were immediately followed on touchstart when using a touch-enabled device. This update makes sure links are followed at touchend, to improve usability and menu behavior. Props anevins, panchen, kjellr. Fixes #45510. git-svn-id: https://develop.svn.wordpress.org/branches/5.0@44357 602fd350-edb4-49c9-b593-d223f7449a82 --- .../twentynineteen/js/touch-keyboard-navigation.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/wp-content/themes/twentynineteen/js/touch-keyboard-navigation.js b/src/wp-content/themes/twentynineteen/js/touch-keyboard-navigation.js index 652ff464af21..a466195c16f5 100644 --- a/src/wp-content/themes/twentynineteen/js/touch-keyboard-navigation.js +++ b/src/wp-content/themes/twentynineteen/js/touch-keyboard-navigation.js @@ -219,19 +219,9 @@ var url = event.target.getAttribute( 'href' ) ? event.target.getAttribute( 'href' ) : ''; - // If there’s a link, go to it on touchend - if ( '#' !== url && '' !== url ) { - window.location = url; - // Open submenu if url is # - } else if ( '#' === url && event.target.nextSibling.matches('.submenu-expand') ) { - + if ( '#' === url && event.target.nextSibling.matches('.submenu-expand') ) { openSubMenu( event.target ); - - // Prevent default touch events - } else { - - event.preventDefault(); } }