There’s 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