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

Question

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

0
, , LEMcNamara 3 years 2020-08-22T21:10:38-05:00 0 Answers 43 views 0

Leave an answer

Browse
Browse