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