Summary
Learn how to use the browser’s console tab to find the last item to have focus.
This post was restored from the Wayback Machine. It was originally published on September 20, 2019
There are a lot of times when you need to find out which item on a page has focus. This is especially tricky when controlling focus as you move in and out of modals and components. Here’s how you can get the object with focus on a web page.
- Open inspector and choose the console tab.
- Type:
document.activeElement
This will return the element that currently has focus
