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