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