Track element focus  |  Chrome DevTools  |  Chrome for Developers Skip to main content Docs Build with Chrome Learn how Chrome works, participate in origin trials, and build with Chrome everywhere. Web Platform Capabilities ChromeDriver Extensions Chrome Web Store Chromium Web on Android Origin trials Release notes Productivity Create the best experience for your users with the web's best tools. DevTools Lighthouse Chrome UX Report Accessibility Modern Web Guidance Get things done quicker and neater, with our ready-made libraries. Workbox Puppeteer Experience Design a beautiful and performant web with Chrome. AI Performance CSS and UI Identity Payments Privacy and security Resources More from Chrome and Google. All documentation Baseline web.dev PageSpeed Insights audit Isolated Web Apps (IWA) Case studies Blog New in Chrome / English Deutsch Español – América Latina Français Indonesia Italiano Nederlands Polski Português – Brasil Tiếng Việt Türkçe Русский עברית العربيّة فارسی हिंदी বাংলা ภาษาไทย 中文 – 简体 中文 – 繁體 日本語 한국어 Sign in Docs Chrome DevTools DevTools Get started AI assistance Overview Get started Chat with AI assistance Generate code in Console and Sources Data usage Panels Popular Elements Console Lighthouse Memory Network Performance Recorder Rendering Security Sources All Autofill Animations Application Changes Coverage CSS overview Developer resources Issues Layers Lighthouse Media Memory Inspector Network conditions Request conditions Performance monitor Protocol monitor Quick source Sensors WebAudio WebAuthn What's new Settings Accessibility For agents Docs More DevTools Get started AI assistance More Panels More Settings Accessibility For agents Case studies Blog New in Chrome Accessibility DevTools features Contrast and readability Track elements focus Navigate DevTools with assistive technology Resources Learn Accessibility MDN DevTools engineering blog Build with Chrome Web Platform Capabilities ChromeDriver Extensions Chrome Web Store Chromium Web on Android Origin trials Release notes Productivity DevTools Lighthouse Chrome UX Report Accessibility Modern Web Guidance Workbox Puppeteer Experience AI Performance CSS and UI Identity Payments Privacy and security Resources All documentation Baseline web.dev PageSpeed Insights audit Isolated Web Apps (IWA) Overview Get started Chat with AI assistance Generate code in Console and Sources Data usage Popular Elements Console Lighthouse Memory Network Performance Recorder Rendering Security Sources All Autofill Animations Application Changes Coverage CSS overview Developer resources Issues Layers Lighthouse Media Memory Inspector Network conditions Request conditions Performance monitor Protocol monitor Quick source Sensors WebAudio WebAuthn What's new Home Docs Chrome DevTools Accessibility Track element focus Stay organized with collections Save and categorize content based on your preferences. Kayce Basques X GitHub Alexandra Klepper GitHub Bluesky 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. Learn more in Watch JavaScript values in real-time with Live Expressions. Type document.activeElement. Click outside of the Live Expression interface to save. The value after document.activeElement is the result of the expression. Since that expression always represents the focused element, you can 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 Open in Elements panel to show the element in the DOM Tree in 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. Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Last updated 2025-12-14 UTC. [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-12-14 UTC."],[],[]] Contribute File a bug See open issues Related content Chromium updates Case studies Archive Podcasts & shows Follow @ChromiumDev on X YouTube Chrome for Developers on LinkedIn RSS Terms Privacy Manage cookies English Deutsch Español – América Latina Français Indonesia Italiano Nederlands Polski Português – Brasil Tiếng Việt Türkçe Русский עברית العربيّة فارسی हिंदी বাংলা ภาษาไทย 中文 – 简体 中文 – 繁體 日本語 한국어