-
Notifications
You must be signed in to change notification settings - Fork 79
SC1-1-1-filename-is-valid-accessible-name #263
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
Changes from all commits
25116ec
3538512
88c201f
fc9a500
17ae1b5
8de0bbb
64f132b
5572ad8
8e12152
bbd3060
7aa2c6d
8e2abf7
50c8d71
c01470c
cfe3299
77cb7c4
934326a
71a10e2
e605dd1
d5edb78
1f8b12e
d3fe69b
f865550
7e2b5fb
00eb1e9
fc0e99f
5c5ba17
5da2252
7450d01
c3cc169
c82bdae
8207556
5527a16
94fe44b
4665845
ad61d73
00b4e1c
865ee36
92454d7
da97527
5c11da3
452db0f
865c0b6
8f99add
e713912
ab08215
c3a60dc
e522382
5addee3
9a54d3e
ebb8c07
8868f17
e675926
d706ff7
c4fdd97
9c2d682
4c0faf8
64c5739
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 |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| --- | ||
| name: Filename is valid accessible name | ||
| description: | | ||
| This rule checks that image elements that use their source filename as their accessible name do so without loss of information to the user. | ||
|
|
||
| success_criterion: | ||
| - 1.1.1 # Non-Text Content | ||
|
|
||
| test_aspects: | ||
| - DOM Tree | ||
| - CSS Styling | ||
|
|
||
| authors: | ||
| - Bryn Anderson | ||
| --- | ||
|
|
||
| ## Test procedure | ||
|
|
||
| ### Applicability | ||
|
|
||
| The rule applies to any HTML `input` element with a [`type`](https://www.w3.org/TR/html/sec-forms.html#dom-htmlinputelement-type) of `image`, or any HTML element with the [semantic role](#semantic-role) of `img`, that is [included in the accessibility tree](#included-in-the-accessibility-tree), and has an [accessible name](#accessible-name) that is equivalent to the [filename](#filename) specified in the `src` attribute. Difference in letter casing, and forward and trailing whitespace should be ignored. | ||
|
|
||
| ### Expectation | ||
|
|
||
| Each test target has an accessible name that serves an equivalent purpose to the [non-text content](https://www.w3.org/TR/WCAG21/#dfn-non-text-content). | ||
|
|
||
| ## Assumptions | ||
|
|
||
| *There are currently no assumptions* | ||
|
|
||
| ## Accessibility support | ||
|
|
||
| *There are no major accessibility support issues known for this rule.* | ||
|
|
||
| ## Background | ||
|
|
||
| - [Understanding Success Criterion 1.1.1: Non-text Content](https://www.w3.org/WAI/WCAG21/Understanding/non-text-content.html) | ||
| - [F30: Failure of Success Criterion 1.1.1 and 1.2.1 due to using text alternatives that are not alternatives (e.g., filenames or placeholder text)](https://www.w3.org/WAI/WCAG21/Techniques/failures/F30) | ||
|
|
||
| ## Test Cases | ||
|
|
||
Brynanders marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ### Passed | ||
|
Member
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. It doesn't seem like any of the passed / failed examples would be applicable. The applicability doesn't say to ignore file extensions or its file path.
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. @WilcoFiers the applicability refers to a definition of "filename" https://github.com/auto-wcag/auto-wcag/blob/master/pages/glossary/filename.md which excludes the file path and appended query strings.
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. @WilcoFiers @kasperisager and I have reworked some of the test cases to fit the applicability. Please can you give this another look. |
||
|
|
||
| #### Passed example 1 | ||
|
|
||
| The `img` element's accessible name uses the filename which accurately describes the image. | ||
|
|
||
| ```html | ||
| <img src="https://www.w3.org/WAI/demos/bad/img/w3c" alt="w3c"> | ||
Brynanders marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| #### Passed example 2 | ||
|
|
||
| The `img` element's accessible name uses the filename, which in combination with the `a` element accurately describes the image. | ||
|
|
||
| ```html | ||
| <a href="https://www.w3.org/WAI/demos/bad/img/w3c.png" download>Download <img src="w3c.png" alt="w3c.png"></a> | ||
| ``` | ||
|
|
||
| ### Failed | ||
|
|
||
| #### Failed example 1 | ||
|
|
||
| The `img` element's accessible name matches the image filename. However the presence of the file extension in the accessible name is redundant and results in the accessible name not accurately describing the image. | ||
|
|
||
| ```html | ||
| <img src="https://www.w3.org/WAI/demos/bad/img/w3c.png" alt="w3c.png"> | ||
| ``` | ||
|
|
||
Brynanders marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| #### Failed example 2 | ||
|
|
||
| The `input` element with a `type` of `image` has an accessible name that matches the filename. However the presence of the file extension in the accessible name is redundant and results in the accessible name not accurately describing the image. | ||
|
|
||
| ```html | ||
| <input type="image" src="https://www.w3.org/WAI/demos/bad/before/img/top_weather.gif" alt="top_weather.gif"> | ||
| ``` | ||
|
|
||
| ### Inapplicable | ||
|
|
||
| #### Inapplicable example 1 | ||
|
|
||
| The `img` element doesn't have the semantic role of image. | ||
|
|
||
| ```html | ||
| <img role="presentation"> | ||
| ``` | ||
|
|
||
| #### Inapplicable example 2 | ||
|
|
||
| The `img` element is not included in the accessibility tree. | ||
|
|
||
| ```html | ||
| <img style="display:none;"> | ||
| ``` | ||
|
|
||
| #### Inapplicable example 3 | ||
|
|
||
| The `img` element's accessible name is not equivalent to the file name specified in the `src` attribute. | ||
|
|
||
| ```html | ||
| <img src="https://www.w3.org/WAI/demos/bad/after/img/teaser_right2.jpg" alt="modanna lily"> | ||
| ``` | ||
|
|
||
| #### Inapplicable example 4 | ||
|
|
||
| The `img` element's `alt` attribute matches the filename but is overridden by the `aria-label` value which takes precedence in the accessible name calculation. | ||
|
|
||
| ```html | ||
| <img src="https://www.w3.org/WAI/demos/bad/after/img/teaser_right2.jpg" alt="teaser_right2.jpg" aria-label="modanna lily"> | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,4 +3,6 @@ title: Decorative | |
| key: decorative | ||
WilcoFiers marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| --- | ||
|
|
||
| Serving only an aesthetic purpose, providing no information, and having no functionality. | ||
| Serving only an aesthetic purpose, providing no information, and having no functionality. | ||
|
|
||
| **Note:** Authors can mark an `img` element as decorative to indicate that it should be ignored by assistive technology by using either `role="presentation"`, `role="none"`, or `alt=""`. An element should only be marked as decorative if removing the element does not cause a loss of information to the user. | ||
|
Collaborator
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. Are there any elements other than 'img' that could be marked as decorative, such as 'svg'?
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. The context of this rule is
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. I could change this to say "Authors can mark elements as decorative..." if you think that would make more sense? |
||
Uh oh!
There was an error while loading. Please reload this page.