Skip to content

Image has a long description attribute #108

@alvaromontoro

Description

@alvaromontoro

Describe the new a11y feature or project enhancement

The longdesc attribute in images is deprecated and should not be used. It is not fully supported by HTML5, browsers, or screen readers. When present, it is commonly misused (it should point to an URL that is not an image).

Describe the solution you'd like

Show a warning if:

  • an image has the longdesc attribute. Recommend the removal of the attribute and adding the information on the same page (e.g. with an aria-describedby)

Show an error if:

  • The value of longdesc is not a URL (this may be tricky as it could be a relative path).
  • The value of longdesc contains spaces (then it would be text and not a URL)
  • The value of londgesc is a link to an image. This could be tested via CSS by checking if the end of the value is an image extension (e.g. ".jpg", ".jpeg", ".png", ".gif", etc.)
  • The value of longdesc is empty.

Testing the first two points may be tricky and lead to false positives (e.g. a URL that has not been encoded and contains white space). Because of that, maybe those two cases should be ignored.

Link(s)

Metadata

Metadata

Assignees

Labels

a11y featureNew feature or request for an a11y checkgood first issueGood for newcomers

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions