Rule 2ee8b8 ("Visible label is part of accessible name"): introducing a new "label in name algorithm". #2075
Conversation
…l in name algorithm". It's intended mostly to handle whitespace and punctuation.
|
@dan-tripp-siteimprove Since this is being worked on still by @kengdoj, can we set this to draft? |
Done |
Jym77
left a comment
There was a problem hiding this comment.
This looks good. I like the details and the many new examples that explicit the decisions we've taken.
pages/glossary/visible-inner-text.md
Outdated
|
|
||
| The <dfn id="for-text">visible inner text of a [text node][]</dfn> is: | ||
| - if the [text node][] is [visible][], its visible inner text is its [data][]; | ||
| - if the [text node][] is not-[visible][], [rendered][], and contains only [whitespace][], its visible inner text is the string `" "` (a single ASCII whitespace); |
There was a problem hiding this comment.
The conditional here sounds a bit weird 🤔
Notably, a text node that is not visible, rendered, and contains more than whitespace (e.g. in <span style="visibility: hidden">Hello</span>) would not trigger it and therefore have an empty string as visible inner text (rather than a whitespace).
There was a problem hiding this comment.
Interesting question. I don't know the answer. But I'll note that I copied this definition from sanshikan so if it needs fixing here, it probably needs fixing there too.
There was a problem hiding this comment.
OK, doing some archaeology, this is due to the fact that whitespace are not visible per our definition…
<button aria-label="hello world"><span>hello</span><span id="space"> </span><span>world</span></button>The span#space is not visible (and neither is its child text node). So the first bullet doesn't apply. Without the second bullet, the visible inner text of the button would be helloworld, not matching the accessible name of hello world due to spacing…
I guess we need to add an example to show that.
There was a problem hiding this comment.
This raises another question: what should we do with this?
<a aria-label="Download specification" href="#"><span>Download</span><span style="visibility: hidden">x</span><span>specification</span></a>
According to the current definition, because of the clause "contains only [whitespace][]", the visible inner text of the <a> element is "Downloadspecification". Visually it looks like "Download specification". So I wonder if we could remove the clause "contains only [whitespace][]". What do you think?
There was a problem hiding this comment.
Good point 🤔 But if the span was invisible due to absolute positioning out of viewport, it shrould be removed:
<a aria-label="Download specification" href="#"><span>Download</span><span style="position: absolute; left: -9999px">x</span><span>specification</span></a>I guess the true condition is whether it creates a CSS box that lies somewhere between the ones of the rest of the text taking part in the computation (and isn't fully contained in them), or something like that 🙈
Or maybe we just make the special case for visibility: hidden and assume that these is already a corner case and that it won't create too many true problems (We've been using that definition in Alfa for two years and I don't remember seeing a problem caused by it, so it may be safe to assume that it is a good enough approximation).
There was a problem hiding this comment.
This has given me a lot to think about. I'll try to bring it up in our next one-on-one meeting.
…://github.com/Siteimprove/sanshikan/blob/main/terms/visible-inner-text.md) - changing glossary links' prefixes from "./" to "#". I don't know if the former was working or not. but the latter is the common practice, it seems.
Co-authored-by: Jean-Yves Moyen <jym@siteimprove.com>
Co-authored-by: Jean-Yves Moyen <jym@siteimprove.com>
…placing it with a new idea: the algorithm 'return value' eg. 'returns "is contained"'. - rewording rule expectation. I think that 'For the target element' is better than 'For each target element' because for this rule, the computation of the expecation for each applicable target element is done in isolation from the other applicable targets on the page. It's simpler if the "for loop" over all applicable targets is done by the tool, not the rule.
…s algorithm is for.
|
|
||
| #### Passed Example 8 | ||
|
|
||
| Similar to the previous example. |
There was a problem hiding this comment.
Maybe include additional description, like:
| Similar to the previous example. | |
| Similar to the previous example. The [label in name algorithm][] inserts whitespace. |
non-standard / nonstandard - hyphenation. because of the review comment at act-rules#2075 (comment)
…iteimprove/act-rules.github.io into rule-2ee8b8-may-2023
Co-authored-by: Kathy Eng <kengdoj@users.noreply.github.com>
Co-authored-by: Kathy Eng <kengdoj@users.noreply.github.com>
Co-authored-by: Kathy Eng <kengdoj@users.noreply.github.com>
…iteimprove/act-rules.github.io into rule-2ee8b8-may-2023
|
@kengdoj regarding "Passed Example 8" - I agree that something should be added. However to say that the algorithm "inserts" whitespace could be misleading. The words "insert whitespace" appear in the previous example to explain what the algorithm doesn't do. At any rate, I just made commit bac2432 as an attempt to fix this. Let me know. |
rule updated
…n during meeting today.
…ed image resources]". adding corresponding note in background. due to discussion in the meeting today.
<< Describe the changes >>
Closes issue(s):
Need for Call for Review:
This will require a 2 weeks Call for Review
Pull Request Etiquette
When creating PR:
developbranch (left side).After creating PR:
Rule,DefinitionorChore.When merging a PR:
How to Review And Approve