Make WordPress Core

Changeset 55970


Ignore:
Timestamp:
06/21/2023 09:30:26 PM (11 months ago)
Author:
audrasjb
Message:

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).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentynineteen/js/touch-keyboard-navigation.js

    r47122 r55970  
    275275        document.addEventListener('focus', function(event) {
    276276
    277             if ( event.target.matches('.main-navigation > div > ul > li a') ) {
     277            if ( event.target != window.document && event.target.matches( '.main-navigation > div > ul > li a' ) ) {
    278278
    279279                // Remove Focused elements in sibling div.
Note: See TracChangeset for help on using the changeset viewer.