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)
Describe the new a11y feature or project enhancement
The
longdescattribute 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:
longdescattribute. Recommend the removal of the attribute and adding the information on the same page (e.g. with anaria-describedby)Show an error if:
longdescis not a URL (this may be tricky as it could be a relative path).longdesccontains spaces (then it would be text and not a URL)londgescis 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.)longdescis 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)