( function( window, document ) {
  function food_blogger_hub_keepFocusInMenu() {
    document.addEventListener( 'keydown', function( e ) {
      const food_blogger_hub_nav = document.querySelector( '.sidenav' );
      if ( ! food_blogger_hub_nav || ! food_blogger_hub_nav.classList.contains( 'open' ) ) {
        return;
      }
      const elements = [...food_blogger_hub_nav.querySelectorAll( 'input, a, button' )],
        food_blogger_hub_lastEl = elements[ elements.length - 1 ],
        food_blogger_hub_firstEl = elements[0],
        food_blogger_hub_activeEl = document.activeElement,
        tabKey = e.keyCode === 9,
        shiftKey = e.shiftKey;
      if ( ! shiftKey && tabKey && food_blogger_hub_lastEl === food_blogger_hub_activeEl ) {
        e.preventDefault();
        food_blogger_hub_firstEl.focus();
      }
      if ( shiftKey && tabKey && food_blogger_hub_firstEl === food_blogger_hub_activeEl ) {
        e.preventDefault();
        food_blogger_hub_lastEl.focus();
      }
    } );
  }
  food_blogger_hub_keepFocusInMenu();
} )( window, document );