A16
Warning
Accessibility
A16 — One id on several elements
A literal id: inside a for, or in a component placed more than once, gives several elements one id; a label's for and aria-* find only the first.
What the compiler said
warning[A16]: `id: "row"` is inside a `for`, so the page has several elements with one id --> src/App.wf:4:26 | 4 | for r in rows by r { Text(r, id: "row") } | ^^^^ = help: Make it unique — `id: "row-{item.id}"` — or drop it; a label's `for` and `aria-*` find one element by id = docs: https://webfluent.monzeromer.dev/errors/A16
The fix
Broken
page P(path: "/", title: "T", description: "D") {
state rows = ["a", "b"]
Heading("Rows").h1
for r in rows by r { Text(r, id: "row") }
}
Fixed
page P(path: "/", title: "T", description: "D") {
state rows = ["a", "b"]
Heading("Rows").h1
for r in rows by r { Text(r, id: "row-{r}") }
}
Make it unique — id: "row-{r}" — or drop it.
Each example is a whole program: it is all of src/App.wf in a project with no other .wf file (trying an example).
Why this rule exists
Warning.
lints may lower it:
"lints": { "A16": "off" }
// wf-allow(A16)