-
Notifications
You must be signed in to change notification settings - Fork 72
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
Rule update: Name from content included in accessible name (2ee8b8) #452
Rule update: Name from content included in accessible name (2ee8b8) #452
Conversation
Splitting this one out into #452
Splitting this one out into #452
Splitting this one out into #452
Splitting this one out into #452
Discussion on "character" definition taken from the PR (#430) that this one has been split out from:
|
_rules/SC2-5-3-name-from-content-included-in-accessible-name.md
Outdated
Show resolved
Hide resolved
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.
Splendid work.
The first 2 examples should be inapplicable examples. Apart from that I will approve this.
_rules/SC2-5-3-name-from-content-included-in-accessible-name.md
Outdated
Show resolved
Hide resolved
_rules/SC2-5-3-name-from-content-included-in-accessible-name.md
Outdated
Show resolved
Hide resolved
Another fun example, related to #976: <div role="link" aria-label="next
page">Next page</div> As far as I understand accessible name computation, the extra spaces and newline should be removed from the accessible name when it is flattened and thus this should pass the rule even though the name from content is not included in the |
Reviewers, I have updated this rule. Please review again. I am aware of the failing test status check, but this should not stop from reviewing. |
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.
editorial changes needed
|
||
## Expectation | ||
|
||
The complete [visible text content](#visible-text-content) of the target element either matches or is contained within its [accessible name][]. | ||
After removing all [punctuation](#punctuation) from both the [visible](#visible) [descendant text content](https://dom.spec.whatwg.org/#concept-descendant-text-content) and the [accessible name](#accessible-name), the [visible](#visible) [descendant text content](https://dom.spec.whatwg.org/#concept-descendant-text-content) of the target element is [included](#included-characters) in its entirety within the [accessible name](#accessible-name) of the element, except for parts of the [visible](#visible) [descendant text content](https://dom.spec.whatwg.org/#concept-descendant-text-content) that do not express anything in [human language](https://www.w3.org/TR/WCAG21/#dfn-human-language-s) and therefore does not live up to the [WCAG definition of text](https://www.w3.org/TR/WCAG21/#dfn-text). |
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.
How do you compute "visible descendant text content"?
<button>
<span id="foo">foo</span>
<span id="space"> </span>
<span id="hidden" style="display: none">foobar</span>
<span id="bar">bar baz</span>
<span id="off-screen" style="position: absolute; left: -999px;">Hello</span>
</button>
What is the "visible descendant text content" of this button
?
For this rule purpose, the intend is probably that it should be foo bar baz
but
- Why should we include the invisible
span id="space"
but exclude the invisiblespan id="hidden"
orspan id="off-screen"
? - Even within the
span id="bar"
, why do we include the invisible space character?
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've been talking with @kasperisager about this (and my related issues with the definition of visible, see #977).
One way out of it would be to have a definition of "rendered node" (or similar) in the line of:
a node is rendered if removing it from the DOM tree changes the rendered content.
That way, the span id="space"
above would contain a rendered text node (with text content " "
). But the span id="hidden"
and span id="off-screen"
would not.
Similarly, an example like #977 (comment)
<p style="background: #white; text-shadow: black 0 0 0px">
<span style="color: rgba(0,0,0,0); ">Some text in a human language</span>
</p>
where the text is technically not visible (only the shadow is) would still have a rendered text node.
The drawbacks with that are:
- Some nodes like above can be invisible but still have rendered text nodes descendants. That's a bit weird but fairly OK (and anyway a consequence of whitespace being invisible).
- If the shadow above is made more blurry, it gets harder and harder to read its content, to the point that it gets hard to argue that the text content should be used (e.g. to consider it as a WCAG label).
- Something like
<span style="background: red; color: red;">Foo</span>
has a rendered text node because thespan
stretch for the same width as the text.
(because of these tricky cases and the weird interaction with visible, the definition of rendered can probably use examples…)
All these are pretty edge cases and they can be handled by an assumption in the line of
This rule assumes that no text node is both rendered and not visible.
(likely needs an explanatory note with examples like spaces)
(essentially, "don't use spaces for layout!")
With an assumption like that, this rule can use "visible descendant text nodes" or something similar to grab what is needed.
A character is a [code point](http://unicode.org/glossary/#code_point), specifically an integer, that a computer uses for representing a value within the Unicode system. | ||
As such, multiple characters may represent the same glyph and multiple glyphs may represent the same grapheme. | ||
|
||
## Examples |
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.
Still needs to be done.
Co-Authored-By: Jean-Yves Moyen <jym@siteimprove.com>
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.
Just a couple of editorial. But I think the point raised by @Jym77 needs to be addressed also.
Co-Authored-By: carlosapaduarte <carlosapaduarte@gmail.com>
Closing due to inactivity. |
This pull request has been split out from #430.
Closes issue:
How to Review And Approve