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