-
Notifications
You must be signed in to change notification settings - Fork 78
Image non empty acc name - revised PR #1382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
3ffc43d
937bd1b
6ce992d
efc4d2b
8f0caee
a34dd28
2408708
2f4e8ca
630e6e7
2e061fb
84345a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -36,7 +36,12 @@ htmlHintIgnore: | |||||
|
||||||
## Applicability | ||||||
|
||||||
The rule applies to HTML `img` elements and HTML elements with the [semantic role][] of `img`, except for elements that are not [included in the accessibility tree][]. | ||||||
The rule applies to HTML `img` elements and HTML elements with the [semantic role][] of `img` which render an image and which are [included in the accessibility tree][]. | ||||||
|
||||||
HTML elements render an image if any of the following are true: | ||||||
|
||||||
- The element is an `img` element where the [current request][]'s [state][image request state] is [completely available][]. | ||||||
- The element has a CSS `background-image` that does not [draw nothing](https://www.w3.org/TR/css-backgrounds-3/#the-background-image). | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the "draws nothing" description it's mentioned about the background size: "An image that is empty (zero width or zero height) likewise counts as a layer but draws nothing" Would the following example be also non applicable then, or only the image with the original size of 0 width and height?
|
||||||
|
||||||
## Expectation | ||||||
|
||||||
|
@@ -146,6 +151,33 @@ This `img` element inside a `div` positioned off screen has an [implicit role][] | |||||
</div> | ||||||
``` | ||||||
|
||||||
#### Passed Example 9 | ||||||
|
||||||
This `img` element displays a CSS `background-image` and has an [accessible name][] because of the `alt` attribute. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it need a separate example with a |
||||||
|
||||||
```html | ||||||
<img alt="W3C logo" style="width:72px; height:48px; background-image: url(/test-assets/shared/w3c-logo.png)" /> | ||||||
``` | ||||||
|
||||||
#### Passed Example 10 | ||||||
|
||||||
This `img` element displays a `srcset` and has an [accessible name][] because of the `alt` attribute. | ||||||
|
||||||
```html | ||||||
<img alt="W3C logo" srcset="/test-assets/shared/w3c-logo.png" /> | ||||||
``` | ||||||
|
||||||
#### Passed Example 11 | ||||||
|
||||||
This `img` element displays a `srcset` and has an [accessible name][] because of the `alt` attribute. | ||||||
|
||||||
```html | ||||||
<picture> | ||||||
<source srcset="/test-assets/shared/w3c-logo.png" /> | ||||||
<img alt="W3C logo" width="72" height="48" /> | ||||||
</picture> | ||||||
``` | ||||||
|
||||||
### Failed | ||||||
|
||||||
#### Failed Example 1 | ||||||
|
@@ -188,6 +220,33 @@ This `img` element has an [explicit role][] of `none`. However, it is [focusable | |||||
<img role="none" tabindex="0" src="/test-assets/shared/w3c-logo.png" /> | ||||||
``` | ||||||
|
||||||
#### Failed Example 6 | ||||||
|
||||||
This `img` element displays a CSS `background-image`, has an empty [accessible name][] and an [implicit role][] of `img`. | ||||||
|
||||||
```html | ||||||
<img style="width:72px; height:48px; background-image: url(/test-assets/shared/w3c-logo.png)" /> | ||||||
``` | ||||||
|
||||||
#### Failed Example 7 | ||||||
|
||||||
This `img` element displays a `srcset`, has an empty [accessible name][] and an [implicit role][] of `img`. | ||||||
|
||||||
```html | ||||||
<img srcset="/test-assets/shared/w3c-logo.png" /> | ||||||
``` | ||||||
|
||||||
#### Failed Example 8 | ||||||
|
||||||
This `img` element displays a `srcset`, has an empty [accessible name][] and an [implicit role][] of `img`. | ||||||
|
||||||
```html | ||||||
<picture> | ||||||
<source srcset="/test-assets/shared/w3c-logo.png" /> | ||||||
<img width="72" height="48" /> | ||||||
</picture> | ||||||
``` | ||||||
|
||||||
### Inapplicable | ||||||
|
||||||
#### Inapplicable Example 1 | ||||||
|
@@ -228,10 +287,38 @@ This element is neither an `img` element nor has a role of `img`. | |||||
<div aria-label="W3C logo"></div> | ||||||
``` | ||||||
|
||||||
#### Inapplicable Example 5 | ||||||
|
||||||
This `img` element has no `src` attribute and no `alt` attribute so does not render an image and [represents nothing][]. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
just clarifying it from https://github.com/w3c/aria/pull/2221/files#diff-5c3c8936e81538898c83ae11f5271e9ae9324925713a3b03aca58cbd2a3c3014R3133 |
||||||
|
||||||
```html | ||||||
<img /> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at this with fresh eyes. I don't think this is correct. These actually should fail SC 1.1.1. Here's my reasoning:
I think I'd prefer to keep this rule as is to be honest. That ARIA in HTML explicitly says that an
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at the It is exposed as There are two contradictory specs:
The html-aam mapping is here: The HTML spec says:
https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element The HTML spec defines "represents nothing" as meaning the element has no semantics. Note sure what do do here:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should raise the issue to the HTML AAM 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue filed at w3c/html-aam#439 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per w3c/aria#2221 closing that issue, ARIA is moving toward giving these @WilcoFiers Does that solve your concerns about this PR? |
||||||
``` | ||||||
|
||||||
dd8 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
#### Inapplicable Example 6 | ||||||
|
||||||
This `img` element does not display a CSS `background-image`, has no `src` attribute and no `alt` attribute so does not render an image and [represents nothing][]. | ||||||
|
||||||
```html | ||||||
<img style="width:72px; height:48px; background-image: none" /> | ||||||
``` | ||||||
|
||||||
#### Inapplicable Example 7 | ||||||
|
||||||
This `img` element has an `src` attribute which will cause the [image request state][] to be [Broken](https://html.spec.whatwg.org/#img-error). | ||||||
|
||||||
```html | ||||||
<img src="/test-assets/does-not-exist.png" /> | ||||||
``` | ||||||
|
||||||
Comment on lines
+306
to
+313
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WilcoFiers can you weight on this? It doesn't seem like it's in the exception of WCAG 1.1.1 and I am not sure if it's inapplicable.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting problem. After re-reading WCAG definitions a couple times I think that yes, this fails 1.1.1. I think this element falls under non-text content. Content isn't defined in WCAG, but I'd say since this is both in the accessibility tree, and visible to people, I can't see a reason to say this wouldn't be content. It's non-text content because everything that isn't text content is non-text content. SC 1.1.1 applies to all non-text content, we can debate whether this is decorative or not. But in either case not having an alt does fail WCAG. So I agree with you, this should not be inapplicable. |
||||||
[accessible name]: #accessible-name 'Definition of accessible name' | ||||||
[explicit role]: #explicit-role 'Definition of explicit role' | ||||||
[focusable]: #focusable 'Definition of focusable' | ||||||
[implicit role]: #implicit-role 'Definition of implicit role' | ||||||
[included in the accessibility tree]: #included-in-the-accessibility-tree 'Definition of included in the accessibility tree' | ||||||
[presentational roles conflict resolution]: https://www.w3.org/TR/wai-aria-1.1/#conflict_resolution_presentation_none 'Presentational Roles Conflict Resolution' | ||||||
[semantic role]: #semantic-role 'Definition of semantic role' | ||||||
[current request]: https://html.spec.whatwg.org/#current-request 'HTML definition of Current request, 2020/03/06' | ||||||
[image request state]: https://html.spec.whatwg.org/#img-req-state 'HTML definition of Image request state, 2020/03/06' | ||||||
[completely available]: https://html.spec.whatwg.org/#img-all 'HTML definition of Completely available, 2020/03/06' | ||||||
[represents nothing]: https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element:attr-img-src-9 'HTML definition of Represents Nothing, 2020/03/06' |
Uh oh!
There was an error while loading. Please reload this page.