mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Update MD045/no-alt-text to allow violations when an HTML IMG has aria-hidden set to true (fixes #1576).
This commit is contained in:
parent
faf96d513b
commit
b611eba684
7 changed files with 70 additions and 4 deletions
10
doc/Rules.md
10
doc/Rules.md
|
|
@ -1908,7 +1908,7 @@ Tags: `accessibility`, `images`
|
|||
|
||||
Aliases: `no-alt-text`
|
||||
|
||||
This rule is triggered when an image is missing alternate text (alt text)
|
||||
This rule reports a violation when an image is missing alternate text (alt text)
|
||||
information.
|
||||
|
||||
Alternate text is commonly specified inline as:
|
||||
|
|
@ -1933,12 +1933,20 @@ Or with HTML as:
|
|||
<img src="image.jpg" alt="Alternate text" />
|
||||
```
|
||||
|
||||
Note: If the [HTML `aria-hidden` attribute][aria-hidden] is used to hide the
|
||||
image from assistive technology, this rule does not report a violation:
|
||||
|
||||
```html
|
||||
<img src="image.jpg" aria-hidden="true" />
|
||||
```
|
||||
|
||||
Guidance for writing alternate text is available from the [W3C][w3c],
|
||||
[Wikipedia][wikipedia], and [other locations][phase2technology].
|
||||
|
||||
Rationale: Alternate text is important for accessibility and describes the
|
||||
content of an image for people who may not be able to see it.
|
||||
|
||||
[aria-hidden]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-hidden
|
||||
[phase2technology]: https://www.phase2technology.com/blog/no-more-excuses
|
||||
[w3c]: https://www.w3.org/WAI/alt/
|
||||
[wikipedia]: https://en.wikipedia.org/wiki/Alt_attribute
|
||||
|
|
|
|||
10
doc/md045.md
10
doc/md045.md
|
|
@ -4,7 +4,7 @@ Tags: `accessibility`, `images`
|
|||
|
||||
Aliases: `no-alt-text`
|
||||
|
||||
This rule is triggered when an image is missing alternate text (alt text)
|
||||
This rule reports a violation when an image is missing alternate text (alt text)
|
||||
information.
|
||||
|
||||
Alternate text is commonly specified inline as:
|
||||
|
|
@ -29,12 +29,20 @@ Or with HTML as:
|
|||
<img src="image.jpg" alt="Alternate text" />
|
||||
```
|
||||
|
||||
Note: If the [HTML `aria-hidden` attribute][aria-hidden] is used to hide the
|
||||
image from assistive technology, this rule does not report a violation:
|
||||
|
||||
```html
|
||||
<img src="image.jpg" aria-hidden="true" />
|
||||
```
|
||||
|
||||
Guidance for writing alternate text is available from the [W3C][w3c],
|
||||
[Wikipedia][wikipedia], and [other locations][phase2technology].
|
||||
|
||||
Rationale: Alternate text is important for accessibility and describes the
|
||||
content of an image for people who may not be able to see it.
|
||||
|
||||
[aria-hidden]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-hidden
|
||||
[phase2technology]: https://www.phase2technology.com/blog/no-more-excuses
|
||||
[w3c]: https://www.w3.org/WAI/alt/
|
||||
[wikipedia]: https://en.wikipedia.org/wiki/Alt_attribute
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue