Skip to content
AnswerWell geo Documentation

Research · 7 min read · Answerwell

Web Accessibility Tree, Landmarks, Keyboard Focus, and ARIA

How the accessibility tree works, semantic HTML and focus rules, and how to verify pages with Lighthouse and DevTools.

This page summarises guidance from Chrome for Developers, the WHATWG HTML interaction model, Cloudflare Browser Rendering, and related sources on building pages that assistive technologies—and automation that reads the same tree—can understand and operate.

Accessibility tree: what assistive technology and automation see

Section titled “Accessibility tree: what assistive technology and automation see”

The accessibility tree is a structured representation of the page: roles, accessible names, values, and states—the same information screen readers and similar tools use. Cloudflare’s accessibility tree endpoint documents typical uses:

Provide AI agents with a structured page representation for navigation and browser automation workflows

Check roles, accessible names, values, and states exposed to assistive technologies

Identify interactive elements, such as buttons, links, menus, and form fields, that an automation workflow can act on

— Cloudflare, Capture accessibility tree

Chrome’s guidance for agents states that agents review the accessibility tree to find interactive elements, and that missing labels block both users with visual disabilities and agents from completing tasks.

When judging a page, two questions matter, as Chrome DevTools puts it:

Can I navigate the page with a keyboard or screen reader? Are the page’s elements properly marked up for screen readers?

— Google Chrome, Overview of accessibility features in Chrome DevTools

Automated tools mainly help with the second; keyboard and screen-reader testing are required for the first.

Semantic HTML and landmarks: structure readers can skip through

Section titled “Semantic HTML and landmarks: structure readers can skip through”

Landmarks and headings: regional navigation without extra ARIA

Section titled “Landmarks and headings: regional navigation without extra ARIA”

HTML5 landmark elements such as main, nav, and aside are regions assistive technologies can jump to. The Accessibility Coding Guidelines recommend wrapping content in header, nav, main, aside, and footer, using one main per page, and giving multiple nav regions distinguishable names (for example aria-label="Primary"). Headings should use real h1–h6 elements in order, with a single page h1 unless a modal dialog is treated as its own window.

Cloudflare’s documentation style guide adds that content must follow a meaningful sequence when read linearly—prerequisites before steps, explanations before code.

Prefer HTML elements and attributes to ARIA: Avoid <div role="button"> or <a role="button"> and use <button> instead.

— Google Chrome, Prefer native HTML

Native controls already expose the correct role, keyboard behavior, and many states (required, disabled semantics, and so on). ARIA fills gaps where HTML has no matching widget (tabs, complex toolbars), but redundant roles (nav role="navigation", ul role="list" when not needed) add noise. Match ARIA to actual behavior: a role="tab" must support tab keyboard interaction, usually with JavaScript.

Approach When to use
Native button, a href, form controls Default for all standard interactions
WAI-ARIA roles, states, properties Custom widgets with no HTML equivalent
inert on background Custom overlays when native <dialog> is not used
aria-hidden="true" Decorative content only—not on focusable elements

Accessible names, labels, and live updates

Section titled “Accessible names, labels, and live updates”

Naming mechanisms people and screen readers rely on

Section titled “Naming mechanisms people and screen readers rely on”

Every interactive control and many landmarks need an accessible name. Prefer native mechanisms: label with explicit for/id for fields, caption for tables, legend for fieldset. Do not use placeholder or title as the primary name for controls (iframes are the exception for title). When visible text labels a control, include that text unchanged in the accessible name; disambiguate duplicate “Edit” buttons with aria-label, aria-labelledby, or visually hidden text—see Choosing the name.

Associate hints and errors with aria-describedby rather than stuffing them into the label. For images, every img needs alt; decorative images use alt="". Informative inline SVGs use role="img" plus <title> or aria-label.

Live regions announce DOM updates without focus moves. Chrome’s guidelines map urgency to aria-live: assertive or role="alert" only for critical, time-sensitive messages; polite for toasts and status; avoid spamming “Loading…” unless it is genuinely informative. Centralize one polite and one assertive region per page when possible, and coordinate announcements with open dialogs—updates inside inert content may never be heard.

Focus hierarchy and where keyboard events go

Section titled “Focus hierarchy and where keyboard events go”

The WHATWG HTML user interaction model explains that interactive widgets form a hierarchy and that keyboard input is routed to the focused widget:

Keyboard events are always targeted at this focused element.

— WHATWG, 6.6.1 Introduction

Modal dialogs, tabs, and nested controls should preserve that model: focus moves into new UI, stays trapped only when intentional (modal), and returns to the trigger on dismiss—see Managed focus and Focus traps.

Tab order should follow DOM order and reading direction unless you fix structure in the DOM—not with CSS order alone—per Visual order follows DOM order. Rules from Tab order and focusability:

  • Use tabindex="0" only to add focus to custom widgets that already have an appropriate role.
  • Use tabindex="-1" for programmatic focus (skip-link targets, headings after route changes).
  • Never use positive tabindex values.

Focus must be visible: prefer native :focus-visible styling; if you remove the default outline, provide a replacement with at least 3:1 contrast. Target interactive areas for at least 24×24 CSS pixels where possible.

Custom button-like elements need Enter on keydown and Space on keyup to mirror native button behavior. Skip links before repeated navigation help keyboard users bypass chrome—point the skip target at the first meaningful focusable content, often h1 with tabindex="-1".

Custom controls, extensions, and composite widgets

Section titled “Custom controls, extensions, and composite widgets”

Chrome extension accessibility guidance mirrors the open web: standard HTML controls first; for toolbars and similar patterns, role="toolbar" with tabindex="0" and aria-activedescendant can manage which child is active. Lighthouse stresses that a styled div is announced as generic text, while a button is announced as a button—replace faux controls with semantics before layering ARIA.

For arrow-key grids or spatial navigation inside one widget, use a roving tabindex (one tabindex="0", siblings -1) and only intercept arrow keys inside composite widgets—not normal document flow—per Spatial Navigation.

Declare lang on html and on language changes in content. Each page needs a unique, non-empty <title>; SPAs should update the title on view changes. Video needs captions (<track kind="captions">); audio and video need transcripts where required—aligned with Cloudflare multimedia guidance and Audio and video rules.

Offscreen menus and hidden views should be removed from both tab order and the accessibility tree (display: none, visibility: hidden, or inert on background)—see Offscreen content is hidden. Hiding focusable content with aria-hidden while it remains tabbable is a common failure mode.

Testing: automated checks, DevTools, and manual passes

Section titled “Testing: automated checks, DevTools, and manual passes”
Layer What it catches What it misses
Lighthouse accessibility audits Missing names, roles, contrast, ARIA issues Full keyboard journeys, real-world screen reader UX
axe-core / DevTools Accessibility pane Markup and tree inspection Whether focus order feels logical
Keyboard-only pass Tab order, focus traps, indicators —
Screen reader + browser pairs Announcements, landmarks, labels —

Don’t rely purely on scores: A 100% score does not guarantee real usability.

— Google Chrome, Automated checks

In DevTools, the Accessibility pane shows the tree, computed role, and ARIA attributes for the selected node—useful for custom control roles and focusable controls. Manual testing should use Tab, Shift+Tab, arrows, Enter, Space, and Esc across the whole page; Chrome recommends calibrated pairings such as JAWS with Chrome, NVDA with Firefox, VoiceOver with Safari, and TalkBack with Chrome on Android.

  • Custom clickable divs without role, name, keyboard support, or focus style.
  • Trapping focus outside a true modal with no Escape path.
  • Multiple conflicting “Edit” or “Read more” names in one view.
  • Positive tabindex, or visual reordering that disagrees with DOM order.
  • Low-contrast text—among the most frequent automated findings on the public web per Chrome’s color-deficiency tooling notes.
  • Announcing every minor DOM change through live regions.
  1. Run Lighthouse accessibility audits in Chrome DevTools and review failures against Accessibility Coding Guidelines.
  2. Open the Accessibility pane (reference) on key interactive components and confirm roles, names, and states match behavior.
  3. Tab through the entire page without a mouse; confirm logical tab order, visible focus, and no accidental focus traps.
  4. Spot-check landmarks and headings (use landmarks) and hide offscreen content from the tree (offscreen content hidden).
  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about, and we will correct or clarify it.