Detecting focus hack

Load up the site, then open up the console, then just paste in the following code:

document.body.addEventListener('focusin', (event) => {  console.log(document.activeElement)})

Now when you tab, the console should log what element the app is focused in at.

Great for detecting things like if people wrote outline: 0 in the css code, or something wonky is happening where things aren’t tabbing over to the right thing.


Front End Engineer

Love podcasts or audiobooks? Learn on the go with our new app.