hypra

A11Y-008: alt text doesn't describe the image

Warning: the page still builds, but this is most likely a mistake.

Alt text like "image", "photo" or a file name is read aloud in place of the image and tells nothing about it. Say what the image shows, as you would on the phone.

Fails

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  img("/img/runner-x.jpg", alt: "Photo")
  img("/img/runner-x-sole.jpg", alt: "IMG_4217.jpg")
}
warning[A11Y-008]: alt text doesn't describe the image
 --> page.hypra:3:33
  |
3 |   img("/img/runner-x.jpg", alt: "Photo")
  |                                 ^^^^^^^
  = help: say what the image shows, e.g. alt: "Blue running shoe, side view"
  = docs: https://hypralang.dev/rules/a11y-008/

warning[A11Y-008]: alt text doesn't describe the image
 --> page.hypra:4:38
  |
4 |   img("/img/runner-x-sole.jpg", alt: "IMG_4217.jpg")
  |                                      ^^^^^^^^^^^^^^
  = help: alt is a file name; say what the image shows instead
  = docs: https://hypralang.dev/rules/a11y-008/

0 errors, 2 warnings

Fixed

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  img("/img/runner-x.jpg", alt: "Runner X in blue, side view")
  img("/img/runner-x-sole.jpg", alt: "The sole of the Runner X, with deep lugs")
}

File names are flagged on every page. Words like "photo" are checked in the page's language: English, German, French, Spanish, Portuguese, Italian and Dutch.