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