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