Accessibility audit of DOM drawn in a canvas

The claim for HTML-in-canvas is that the pixels are still elements, so they can be focused, searched and selected and they're in the accessibility tree. I wanted to check that, so this page tests it four ways: probes of the API, a table of the patterns used on this site, the same audit run over every page here, and a short list that only a person can do.

A · What the API gives you probes on small fixtures

Show the code how a probe is set up

Once the probes have run, every row has its own Show the code link with the exact function it ran.

  1. rig(): a drawable canvas, some children, and a draw function called on every paint. This is the smallest complete HTML-in-canvas set-up: the content="drawable" and layoutsubtree attributes on the canvas, drawable on each child, and drawElementImage() in the paint handler.
  2. The thirteen patterns of section B. One page that builds the same card each way.
  3. The audit itself. auditDocument(doc) runs on any same-origin page.

B · Pattern by pattern the same card, put in a canvas thirteen ways

Each row builds one small card (heading, a sentence, a text field, a button, a link) into a canvas a different way, then measures five things: focus, selection, find, zoom and forced colours. The last column was recorded from outside the browser with the DevTools protocol, which can read the real accessibility tree and press a real Tab key. Select a cell for the detail.

About a minute. Runs in the frame further down; nothing starts until you ask.

C · Every demo, audited runs in the frame below

The demo list is read from the shared menu (/shared/pages.js, built from each page's page.json), so a new demo is audited as soon as it has a page file. To audit any other same-origin page, enter its path. Select a cell for the detail. The first two columns are about behaving on a phone: has the page scrolled, taken focus or jumped about by the time its own checks finish, and is every canvas showing a picture. /a11y/?url=/slot/ checks one page straight away.

A few minutes: each demo is loaded, left to settle, then measured.

✓ holds up! works with a caveat✗ broken for some users– nothing to test

D · Needs a person about ten minutes

None of these can be scripted from a page. The panel is drawn tilted and offset on purpose, so anything positioned from stale geometry shows up in the wrong place. Your verdicts are kept in this browser and included in "Copy results".

Try me with a screen reader A link

    E · Checked with the DevTools protocol Chromium 157 headless, 2026-11-20

    A page can't ask these things about itself, so they were driven from outside the browser while the audit was built.

    ✓ worksAccessibility tree
    Accessibility.getFullAXTree on a canvas with a labelled input, button and link.
    The canvas is a "Canvas" node and its children are ordinary nodes under it: textbox "Name", button "Press me", link, StaticText. Roles and names are the same as outside a canvas.
    ✓ worksReal Tab key
    Input.dispatchKeyEvent Tab, six times.
    Focus walks the canvas children in DOM order. Each focus change fires a paint event with the right changedElements.
    ✗ failsUndrawn element in the tree
    A drawable child the paint handler never draws.
    Still a focusable button in the accessibility tree, still a Tab stop, reported at the canvas origin (its static layout position) rather than without geometry. A sighted keyboard user lands on nothing.
    ✓ worksReal mouse
    Click, double-click, drag and shift-click at the drawn position.
    Clicks reach the element, a click in a text field puts the caret there, drag selects text.
    ✓ worksIME composition
    Input.imeSetComposition "にほん", then commit "日本".
    compositionstart, update and end fire; the composing text is painted into the canvas and the committed value is right. Where the candidate window opens needs a real IME.
    ✓ worksForced colours
    Emulation of forced-colors: active.
    The drawn element is repainted in system colours (its yellow background becomes Canvas). The explainer lists forced colours as not sensitive, and this build paints them.
    ✓ worksSystem colours and colour scheme
    Canvas, CanvasText, AccentColor, light-dark() inside a drawn element.
    All painted with their real values. (The explainer says system colours may be left out; this build doesn't leave them out.)
    ! caveatZoom
    CSS zoom 2 on the page.
    Layout and hit testing follow, but a canvas with a fixed width attribute keeps its bitmap and is stretched. A canvas has to resize itself (ResizeObserver with device-pixel-content-box) to stay sharp.

    Findings