From 5e347c1c5218a86d3807bf631b0a2050adbd86c1 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Wed, 21 Jun 2023 21:30:26 +0000 Subject: [PATCH] Twenty Nineteen: Prevent a console error related to the main navigation on Firefox. This changeset improves a JS conditional statement to fix a console error thrown by Firefox on `event.target.matches`. Props kjellr, laurelfulford, audrasjb, dimijazz, ianbelanger, pbiron, poena, McAlyster, janpaulkleijn, swissspidy, mukesh27, rehanali. Fixes #46474. See #45903 (fixes one of the two issues of this ticket). git-svn-id: https://develop.svn.wordpress.org/trunk@55970 602fd350-edb4-49c9-b593-d223f7449a82 --- .../themes/twentynineteen/js/touch-keyboard-navigation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c8d1dd02e6..073102fe23 100644 --- a/src/wp-content/themes/twentynineteen/js/touch-keyboard-navigation.js +++ b/src/wp-content/themes/twentynineteen/js/touch-keyboard-navigation.js @@ -274,7 +274,7 @@ document.addEventListener('focus', function(event) { - if ( event.target.matches('.main-navigation > div > ul > li a') ) { + if ( event.target != window.document && event.target.matches( '.main-navigation > div > ul > li a' ) ) { // Remove Focused elements in sibling div. var currentDiv = getCurrentParent( event.target, 'div', '.main-navigation' );