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