A04
Warning
Accessibility
A04 — A control with no label
A Checkbox, Radio, Switch, Slider or Textarea with no label:.
What the compiler said
warning[A04]: Checkbox missing "label" attribute --> src/App.wf:4:5 | 4 | Checkbox(bind: agree) | ^^^^^^^^ = help: Add a label: Checkbox(bind: value, label: "Description") = docs: https://webfluent.monzeromer.dev/errors/A04
Your editor offers this fix: Add label: "Agree". wf fix --code A04 applies it to every place it fits.
The fix
Broken
page P(path: "/", title: "T", description: "D") {
state agree = false
Heading("Terms").h1
Checkbox(bind: agree)
}
Fixed
page P(path: "/", title: "T", description: "D") {
state agree = false
Heading("Terms").h1
Checkbox(bind: agree, label: "I agree to the terms")
}
Checkbox(bind: agree, label: "I agree to the terms").
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": { "A04": "off" }
// wf-allow(A04)