A18

Warning

Accessibility

A18 — A popover with no name

A Popover drawn as a dialog (it has no other role:) with no label:: a screen reader announces it as a dialog and nothing more.

What the compiler said

warning[A18]: Popover has no accessible name --> src/App.wf:5:5 | 5 | Popover(visible: open, anchor: branch) { Button("feature/layers") } | ^^^^^^^ = help: Say what it is: Popover(visible: open, anchor: button, label: "Branches") = docs: https://webfluent.monzeromer.dev/errors/A18

The fix

Broken

wf

page P(path: "/", title: "T", description: "D") { state open = false Heading("Branches").h1 Button("main", ref: branch) { on click { open = !open } } Popover(visible: open, anchor: branch) { Button("feature/layers") } }

Fixed

wf

page P(path: "/", title: "T", description: "D") { state open = false Heading("Branches").h1 Button("main", ref: branch) { on click { open = !open } } Popover(visible: open, anchor: branch, label: "Branches") { Button("feature/layers") } }

label: "Branches" — what a screen reader says as the focus goes into it. A popover that is something other than a dialog says so with role: ("listbox", "tooltip"), and is named as that role asks.

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": { "A18": "off" } // wf-allow(A18)