JAVASCRIPT   78
handleFirstTab
Guest on 22nd April 2023 09:33:19 PM


  1.  (function () {
  2.       function handleFirstTab(e) {
  3.         if (e.keyCode === 9) { // the "I am a keyboard user" key
  4.           document.body.classList.add('user-is-tabbing');
  5.           window.removeEventListener('keydown', handleFirstTab);
  6.         }
  7.       }
  8.       window.addEventListener('keydown', handleFirstTab);
  9.     })();

Raw Paste

Login or Register to edit or fork this paste. It's free.