Accessibility treefocusrole "name" stategenericbutton "Save"Tabbutton "Save"img "Cup"Tabsearchbox "Search"Tabbutton "Close"Tabbutton "Menu" collapsedbutton "Menu" expanded1<div class="btn">Save</div><div role="button">Save</div>2<button>Save</button>3<img src="cup.jpg" alt="Cup">4<label for="q">Search</label>5<input id="q" type="search">6<button aria-label="Close">×</button>7<button aria-expanded="false"><button aria-expanded="true">8 Menu</button>READERKEYSJS…“Save”“Save, button”“Cup, image”“Search, search box”“Close, button”“Menu, button, collapsed”“Menu, button, expanded”“Tab: Save → Search → Close → Menu”“Save, button”<div><button>CupSearchClosefalseJSrole
Front left: the HTML file; front right: screen reader, keyboard and JavaScript, and what the reader saysBack right: the accessibility tree, one row per element (role, name, state, Tab)Chips: each line's meaning travelling into its tree row; ring: keyboard focusFront left: page.html, eight lines of HTML on a card. Back right: the accessibility tree the browser builds from it, one row per element with its role, name, state and whether Tab can reach it. As each line is read, a chip hops from the line into its row and the row fills in; the strip in front shows what a screen reader says. JavaScript then flips aria-expanded to true, a focus ring follows Tab down the four real controls, and role="button" turns the div into a button in the tree only. Screen readers word things differently (NVDA, JAWS and VoiceOver each have their own phrasing and order). The figure shows the name, role and state they all receive.

Who reads the page

  1. Accessibility means everyone can use a page, however they use a computer. A blind user hears it through a screen reader, a program that reads the page aloud. Others use only a keyboard, never a mouse.

HTML that explains itself

ARIA edits the tree

Keyboard and the first rule

What happens

;; step 1/11 · who
accessibility   everyone can use the page
screen reader   speaks the page (NVDA, JAWS, VoiceOver)
keyboard only   Tab, Enter, Space, arrow keys
both need       HTML that says what each part IS

The tree on the right is simplified. A real one also holds the page itself, the label's own text and plain text nodes; the div's word "Save" sits there as plain text, which is why it is still read. Screen readers word things differently (NVDA, JAWS and VoiceOver each have their own phrasing and order). The figure shows the name, role and state they all receive.