WordPress.org

Make WordPress Core

Ticket #45903: 45903.1.diff

File 45903.1.diff, 1.9 KB (added by audrasjb, 10 months ago)

Patch refresh

  • src/wp-content/themes/twentynineteen/js/priority-menu.js

    diff --git a/src/wp-content/themes/twentynineteen/js/priority-menu.js b/src/wp-content/themes/twentynineteen/js/priority-menu.js
    index 85449b0e24..635072ac95 100644
    a b  
    116116                }
    117117
    118118                // Adds the necessary UI to operate the menu.
    119                 var visibleList  = container.parentNode.querySelector('.main-menu[id]');
    120                 var hiddenList   = visibleList.parentNode.nextElementSibling.querySelector('.hidden-links');
    121                 var toggleButton = visibleList.parentNode.nextElementSibling.querySelector('.main-menu-more-toggle');
     119                var visibleList        = container.parentNode.querySelector('.main-menu[id]');
     120                var nextElementSibling = visibleList.parentNode.nextElementSibling;
     121                var hiddenList   = nextElementSibling.querySelector('.hidden-links');
     122                var toggleButton = nextElementSibling.querySelector('.main-menu-more-toggle');
     123
     124                if ( ! nextElementSibling ) {
     125                        return;
     126                }
    122127
    123128                if ( isOverflowingNavivation( visibleList, toggleButton, container ) ) {
    124129
  • src/wp-content/themes/twentynineteen/js/touch-keyboard-navigation.js

    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..d4c8043829 100644
    a b  
    284284                                var prevLi            = getCurrentParent( event.target, '.main-navigation > div > ul > li', '.main-navigation' ).previousElementSibling;
    285285                                var nextLi            = getCurrentParent( event.target, '.main-navigation > div > ul > li', '.main-navigation' ).nextElementSibling;
    286286
     287                                if ( ! currentDivSibling ) {
     288                                        return;
     289                                }
     290
    287291                                if ( null !== focusedElement && null !== hasClass( focusedElement, focusedClass ) ) {
    288292                                        deleteClass( focusedElement, focusedClass );
    289293                                }