-
Notifications
You must be signed in to change notification settings - Fork 75
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?
Conversation
I don't have repo rights to do these:
Can someone with repo maintainer rights do them? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. Just a small editorial suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good. Some minor comments.
Co-authored-by: Wilco Fiers <[email protected]>
Co-authored-by: Jean-Yves Moyen <[email protected]>
Co-authored-by: Jean-Yves Moyen <[email protected]>
Co-authored-by: Jean-Yves Moyen <[email protected]>
…sents nothing' defintion
I think that's all the requested changes addressed. I think it's important to reference the HTML represents nothing definition somewhere in the rule, but I'm not convinced doing it from the examples is the right place. |
This `img` element has no `src` attribute and no `alt` attribute so does not render an image and [represents nothing][]. | ||
|
||
```html | ||
<img /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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:
- These img elements are content, because they are nodes in the accessibility tree
- There is no text here, so if 1 is true, these quality as non-text content
- Since these are invisible, the "Decoration, Formatting, Invisible" applies
- Since these aren't marked up with
aria-hidden=true
,role=none
oralt=""
, assistive technologies will not consistently ignore them - Because these are not ignored by assistive technologies, the exception isn't met, and so 1.1.1 is not satisfied
I think I'd prefer to keep this rule as is to be honest. That ARIA in HTML explicitly says that an img
with no alt
attribute has a semantic role of img
suggests to me this proposal not how the W3C expects this to be interpreted, even if some AT will ignore some of these (depending on the verbosity setting). It might be better just to mention this in the accessibility support section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the <img/>
example (an image with no src
and no alt
). This isn't rendered on screen in Chrome/FF/Safari. It cannot render non-text content since it has no src
.
It is exposed as role=img
in Chrome/Firefox. The image does not appear in the accessibility tree in Safari.
There are two contradictory specs:
- html-map maps all
img
elements withoutalt
torole=img
(even if they have no src) - the HTML spec says an
img
with noalt
and nosrc
represents nothing (i.e. has no semantics)
The html-aam mapping is here:
https://www.w3.org/TR/html-aam-1.0/#el-img
The HTML spec says:
If the src attribute is not set and either the alt attribute is set to the empty string or the alt attribute is not set at all
The element represents nothing.
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:
- you can make the argument
<img/>
should not fail 1.1.1 since there's no non-text content - you can also make the argument
<img/>
should fail 1.1.1 since it's exposed as an role=img by html-aam
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should raise the issue to the HTML AAM 🤔
To see if img
with no source should still have an image role or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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 comment
The 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 img
elements with no/empty src
an implicit role of none
.
@WilcoFiers Does that solve your concerns about this PR?
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need a separate example with a background: url(./w3c.png)
? Or does this assume that the computed css value if we set a background
will be background-image
?
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
This `img` element has no `src` attribute and no `alt` attribute so does not render an image and [represents nothing][]. | |
This `img` element has no `src` attribute and no `alt` attribute or accessible name so does not render an image and [represents nothing][]. |
just clarifying it from https://github.com/w3c/aria/pull/2221/files#diff-5c3c8936e81538898c83ae11f5271e9ae9324925713a3b03aca58cbd2a3c3014R3133
#### 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" /> | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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.
- It will still render and will be mapped to the image role since
src
is not empty - Some screenreaders might announce a file name instead if there is a
src
attribute (even if it's not loading) but noalt
provided, which would not be the text alternative for the image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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.
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 comment
The 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?
<img
style="
width: 72px;
height: 48px;
background-image: url('./w3c.png'); // image size is 50px by 50px
background-size: 0; // change background size to 0
"
/>
The PR replaces #1208
Reason for new PR: rule has been renamed, and many changes from original PR were merged in #1300
This PR:
<img/>
and<div style='background-image:none'>
inapplicable because they have no visual rendering, and are not voiced)<img/>
as an inapplicable example<img srcset='...'/>
Closes issue(s):
Need for Final Call:
This will require a 2 week Final Call
Pull Request Etiquette
When creating PR:
develop
branch (left side).After creating PR:
Rule
,Definition
orChore
.When merging a PR:
How to Review And Approve