Removing focus ring for non-tab users (vanilla JS to jQuery conversion)


I’m working on an accessibility issue for a client with Genesis Theme on WordPress and some custom jQuery. They need to remove the onFocus indicator border for mouse users, while leaving it intact for tab users. The following JS was suggested on Medium:

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

What might this look like if implemented in JQuery instead? For more context see: https://medium.com/hackernoon/removing-that-ugly-focus-ring-and-keeping-it-too-6c8727fefcd2