Suppose that you're testing the keyboard navigation accessibility of a page. When
navigating the page with the Tab key, the focus ring sometimes disappears
because the element that has focus is hidden. To track the focused element in DevTools:
Open the Console.
Click Create Live Expression.
Figure 1. Creating a Live Expression.
Type document.activeElement.
Click outside of the Live Expression UI to save.
The value that you see below document.activeElement is the result of the expression.
Since that expression always represents the focused element, you now have a way to
always keep track of which element has focus.
Hover over the result to highlight the focused element in the viewport.
Right-click the result and select Reveal in Elements panel to show the element
in the DOM Tree on the Elements panel.
Right-click the result and select Store as global variable to create a variable
reference to the node that you can use in the Console.
Feedback
Was this page helpful?
Yes
What was the best thing about this page?
It helped me complete my goal(s)
Thank you for the feedback. If you have specific ideas on how to improve this page, please
create an issue.
It had the information I needed
Thank you for the feedback. If you have specific ideas on how to improve this page, please
create an issue.
It had accurate information
Thank you for the feedback. If you have specific ideas on how to improve this page, please
create an issue.
It was easy to read
Thank you for the feedback. If you have specific ideas on how to improve this page, please
create an issue.
Something else
Thank you for the feedback. If you have specific ideas on how to improve this page, please
create an issue.
No
What was the worst thing about this page?
It didn't help me complete my goal(s)
Thank you for the feedback. If you have specific ideas on how to improve this page, please
create an issue.
It was missing information I needed
Thank you for the feedback. If you have specific ideas on how to improve this page, please
create an issue.
It had inaccurate information
Thank you for the feedback. If you have specific ideas on how to improve this page, please
create an issue.
It was hard to read
Thank you for the feedback. If you have specific ideas on how to improve this page, please
create an issue.
Something else
Thank you for the feedback. If you have specific ideas on how to improve this page, please
create an issue.