CKTIS / HTML
DevTools: DOM, computed styles, and the accessibility tree
Compare the live DOM, resulting CSS values, and the semantics exposed to assistive technology. Inspect role, name, state, and relations, then try a temporary DOM edit.
Version: Browser DevTools workflow; UI and feature availability vary by browser and version
Syntax
Browser-specific DevTools workflow (not HTML syntax): Elements or Inspector → select the live DOM node; Computed → inspect its resulting CSS values; Accessibility → inspect its exposed role, accessible name, state, and relations. The HTML Living Standard defines the example’s HTML elements and hidden attribute, not the DevTools panels or how they present information.Use the DevTools Elements/Computed/Accessibility tree workflow to answer three different questions. In Elements (Inspector in Firefox), select a node and read its current attributes and text. This is the live DOM, not a copy of the source file: parsing and scripts can change it. Computed shows the selected node's resulting CSS values, such as display, not its accessibility semantics.
The accessibility tree shows what the browser exposes to assistive technology; it is not a one-to-one copy of the DOM. The role tells you what the object is (a native button has role button), and the accessible name identifies it (here it comes from the button text). The state tells you its current condition: aria-expanded signals collapsed (false) or expanded (true). A relation points to another element: aria-controls references the controlled panel's id, even while the panel is hidden. These ARIA attributes don't change visibility on their own; the script updates hidden and keeps the state in sync.
Panel names and relation displays vary by browser. If the hidden panel is absent from the tree, check the ID reference in the DOM and inspect the relation after opening the panel if the tool shows it. Inspection does not replace testing with a keyboard and a screen reader.
An ordinary inspector edit changes only the currently loaded DOM. It doesn't save to the file or server, and a normal reload discards it. To keep a fix, make it in your source code.
Examples
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Inspect shipping details</title>
</head>
<body>
<button type="button" id="toggle" aria-expanded="false" aria-controls="panel">Shipping</button>
<section id="panel" aria-label="Shipping details" hidden style="display: none">
<p>Ships on Monday.</p>
</section>
<script>
const button = document.getElementById('toggle');
const panel = document.getElementById('panel');
button.addEventListener('click', () => {
const open = panel.hidden;
panel.style.display = open ? 'block' : 'none';
panel.hidden = !open;
button.setAttribute('aria-expanded', String(open));
});
</script>
</body>
</html>Result
Initially: only Shipping is visible. The button has role button, accessible name Shipping, and a collapsed state (aria-expanded="false"). The panel is in the DOM with display: none; it is not exposed as a region. After activating Shipping once: Ships on Monday. appears. The panel has display: block and is exposed as a region named Shipping details. The button is expanded (aria-expanded="true"); aria-controls still points to panel. How the relationship is displayed depends on the inspector. After editing just the button's text node to Delivery: the visible label and accessible name become Delivery; the panel stays open. After a normal reload: Shipping returns and the panel is collapsed again.
Open `Shipping` and compare `display: none` with `display: block` for `#panel`. Change just the button's text node to `Delivery`: the accessible name changes, but the panel stays open. Reload to restore `Shipping` and the collapsed state.
Related lessons
- HTML · Lesson 39 · Intermediate · Version: 2