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
This commit is contained in:
Jb Audras
2023-06-21 21:30:26 +00:00
parent ffcf68b2de
commit 5e347c1c52
@@ -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' );