A02

Warning

Accessibility

A02 — An icon button with no name

An IconButton with no label:, which is its accessible name.

What the compiler said

warning[A02]: IconButton missing accessible label --> src/App.wf:3:5 | 3 | IconButton(icon: "close") | ^^^^^^^^^^ = help: Add a label: IconButton(icon: "close", label: "Close dialog") = docs: https://webfluent.monzeromer.dev/errors/A02

Your editor offers this fix: Add label: "Close". wf fix --code A02 applies it to every place it fits.

The fix

Broken

wf

page P(path: "/", title: "T", description: "D") { Heading("Close").h1 IconButton(icon: "close") }

Fixed

wf

page P(path: "/", title: "T", description: "D") { Heading("Close").h1 IconButton(icon: "close", label: "Close") }

IconButton(icon: "close", label: "Close") — the label is read aloud, never shown.

Each example is a whole program: it is all of src/App.wf in a project with no other .wf file (trying an example).

lints may lower it:

"lints": { "A02": "off" } // wf-allow(A02)