Title: Menu stops working sometimes
Last modified: August 23, 2020

---

# Menu stops working sometimes

 *  [joehealy](https://wordpress.org/support/users/joehealy/)
 * (@joehealy)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/menu-stops-working-sometimes/)
 * We are using the Jalbee theme and love it!
 * However, we find the menu functionality on mobile (narrow screens) a little bit
   unreliable – particularly on Chrome (desktop with narrow window or mobile).
 * Sometimes when you click on the MENU button, nothing happens and an exception
   is raised:
 * Uncaught TypeError: Cannot read property ‘querySelector’ of null
    at jalbeeInitMenuToggle(
   navigation.js?ver=20180514:121) at navigation.js?ver=20180514:23 at navigation.
   js?ver=20180514:262
 * This only seems to occur every second time.
 * Other times, it works fine.
 * This makes it pretty difficult to use the theme on mobiles.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fmenu-stops-working-sometimes%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [joehealy](https://wordpress.org/support/users/joehealy/)
 * (@joehealy)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/menu-stops-working-sometimes/#post-13332169)
 * This issue in wprig is relevant:
 * [https://github.com/wprig/wprig/issues/136](https://github.com/wprig/wprig/issues/136)
 *  Thread Starter [joehealy](https://wordpress.org/support/users/joehealy/)
 * (@joehealy)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/menu-stops-working-sometimes/#post-13334164)
 * I fixed it with the following patch:
 * diff navigation.js_orig navigation.js
    2a3 > 11,13c12,13 < var JALBEE_SITENAV
   = document.querySelector(‘.main-navigation’), < JALBEE_KEYMAP = { < TAB: 9 — 
   > var JALBEE_KEYMAP = { > TAB: 9 16,20c16,22 < // Initiate the menus when the
   DOM loads. < // document.addEventListener(‘DOMContentLoaded’, function () { <//
   jalbeeInitMainNavigation(); < // jalbeeInitMenuToggle(); < // }); — > if ( ‘loading’
   === document.readyState ) { > // The DOM has not yet been loaded. > document.
   addEventListener( ‘DOMContentLoaded’, initNavigation ); > } else { > // The DOM
   has already been loaded. > initNavigation(); > } 21a24,25 > // Initiate the menus
   when the DOM loads. > function initNavigation() { 24c28,31 < /** — > doSomethingElse();
   > }; > > /** 28a36,37 > const JALBEE_SITENAV = document.querySelector(‘.main-
   navigation’); > 120a130,136 > const JALBEE_SITENAV = document.querySelector(‘.
   main-navigation’); > > // No point if no site nav. > if (!JALBEE_SITENAV) { >
   return; > } > 235a252,259 > function doSomethingElse() { > const JALBEE_SITENAV
   = document.querySelector(‘.main-navigation’); > > // No point if no site nav.
   > if (!JALBEE_SITENAV) { > return; > } > 262c286,288 < })(); \ No newline at 
   end of file — > } > > })();

Viewing 2 replies - 1 through 2 (of 2 total)

 The topic ‘Menu stops working sometimes’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/jalbee/1.0.9/screenshot.png)
 * Jalbee
 * [Support Threads](https://wordpress.org/support/theme/jalbee/)
 * [Active Topics](https://wordpress.org/support/theme/jalbee/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/jalbee/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/jalbee/reviews/)

 * 2 replies
 * 1 participant
 * Last reply from: [joehealy](https://wordpress.org/support/users/joehealy/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/menu-stops-working-sometimes/#post-13334164)
 * Status: not resolved