diff --git a/src/wp-content/themes/twentynineteen/js/priority-menu.js b/src/wp-content/themes/twentynineteen/js/priority-menu.js
index 85449b0e24..c5fc0430d2 100644
a
|
b
|
|
116 | 116 | } |
117 | 117 | |
118 | 118 | // 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 | } |
122 | 127 | |
123 | 128 | if ( isOverflowingNavivation( visibleList, toggleButton, container ) ) { |
124 | 129 | |
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
|
|
284 | 284 | var prevLi = getCurrentParent( event.target, '.main-navigation > div > ul > li', '.main-navigation' ).previousElementSibling; |
285 | 285 | var nextLi = getCurrentParent( event.target, '.main-navigation > div > ul > li', '.main-navigation' ).nextElementSibling; |
286 | 286 | |
| 287 | if ( ! currentDivSibling ) { |
| 288 | return; |
| 289 | } |
| 290 | |
287 | 291 | if ( null !== focusedElement && null !== hasClass( focusedElement, focusedClass ) ) { |
288 | 292 | deleteClass( focusedElement, focusedClass ); |
289 | 293 | } |