Using the inspect element feature can help quickly debug any UI glitches on a website for a specific device. There are also a few dynamic errors, like when using an asynchronous call over an API, and the element does not display any value on the screen. This error can be due to lousy typing or incorrect syntax. For example, there can be certain cases when you apply “color” to the text, but the screen still displays black text. Overview of accessibility testing using DevTools - long article that's a superset of the above linked article.Developing a web application that works perfectly on all devices is a challenging and intriguing task.Use the Inspect tool to detect accessibility issues by hovering over the webpage.To hide the Inspect tool's overlay while you move the mouse pointer over the rendered webpage, press and hold Ctrl. Temporarily hiding the Inspect element tooltip The existing tooltip and grid color overlay for the Inspect tool remains displayed while you hover over different parts of the rendered webpage. Press and hold Ctrl+ Alt (Windows, Linux) or Ctrl+ Option (macOS) while you move around in the rendered webpage. When using the Inspect tool and moving around the rendered webpage, you can keep the current Inspect overlay displayed. Persisting the Inspect tool's tooltip and grid color overlay The Styles tool shows the CSS that's applied to the element.The corresponding DOM node is highlighted.When you click an element in the rendered page: Selecting the element and terminating Inspect mode There's also a color overlay on page layout regions, indicating that you are in an advanced selection mode. To inspect elements that have the CSS property of pointer-events: none, press Shift while hovering over the element. In the Inspect Demo page, hover over the Overlay Button and you will see that the parent element ( div.wrapper) is shown instead of the Overlay Button.
The button can't be navigated to via keyboard, because the button is implemented as a element with a class of button, instead of being implemented as a element.Įlements that have the CSS property of pointer-events: none aren't available to the Inspect tool. The Inspect overlay also shows that the button isn't focusable via keyboard. Whether the element is keyboard focusable.įor example, in the Inspect Demo page, for the Bad Contrast button, the Inspect overlay has a warning icon next to the contrast value of 1.77.The name and the role of the element that's reported to assistive technology.The Accessibility section of the Inspect overlay displays information about: If the element is positioned using CSS grid or CSS flexbox, a different icon appears next to the element's name in the Inspect overlay: Which information is shown depends on the type of element and the styles applied to it. The element's margin and padding, in pixels.The element's color, as a hexadecimal value and a color swatch.The Inspect overlay shows the following information about the element: When you hover over a page element on the rendered page, the DOM tree automatically expands to highlight the element that you are hovering over. The Inspect overlay displays general and accessibility information about that element. When the Inspect tool is active, hovering over any element on the rendered webpage displays the Inspect overlay. Getting element information from the Inspect overlay Clicking in the webpage also turns off Inspect mode in the webpage. The DOM tree in the Elements tool is automatically updated to show the DOM element that corresponds to the clicked item in the rendered webpage, and its CSS styling in the Styles tab. In the rendered webpage, hover over items and watch the information overlay and grid highlighting. The button icon turns blue ( ), indicating that the Inspect tool is active. Or, when DevTools has focus, press Ctrl+ Shift+ C (Windows, Linux) or Command+ Shift+ C (macOS). In the upper left corner of DevTools, click the Inspect tool ( ) button. Right-click anywhere in the demo webpage and then select Inspect, to open DevTools. Open the Inspect Demo page in a new window or tab. When you click an item in the webpage, the DOM tree in the Elements tool is automatically updated to show the DOM element that corresponds to the clicked item in the rendered webpage, and its CSS styling in the Styles tab.
When the Inspect tool is active, you hover over items in the webpage, and DevTools adds an information overlay information and grid highlighting on the webpage. Use the Inspect tool to see information about an item within a rendered webpage.