A01

Warning

Accessibility

A01 — An image with no alt text

An Image with no alt. A screen reader reads the file name; a decorative image takes alt: "".

What the compiler said

warning[A01]: Image missing "alt" attribute --> src/App.wf:3:5 | 3 | Image(src: "/team.jpg") | ^^^^^ = help: Add alt text: Image(src: "...", alt: "Description of image") = docs: https://webfluent.monzeromer.dev/errors/A01

Your editor offers this fix: Add alt: "" — then describe the image, or leave it empty if it is decorative. wf fix --code A01 applies it to every place it fits.

The fix

Broken

wf

page P(path: "/", title: "T", description: "D") { Heading("Photo").h1 Image(src: "/team.jpg") }

Fixed

wf

page P(path: "/", title: "T", description: "D") { Heading("Photo").h1 Image(src: "/team.jpg", alt: "The team at the launch") }

Image(src: "/team.jpg", alt: "The team at the launch"). A purely decorative image takes alt: "".

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