-
Notifications
You must be signed in to change notification settings - Fork 22
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
How should labeledby calculation handle whitespace-only content? #233
Comments
… empty This subtest is failing because some of the whitespace in the aria-labelledby traversal is non-collapsed and shows up in the result, which prevents the aria-label from being applied. Fix this by only using the aria-labelledby result only if it is non-empty and non-whitespace-only. Note, the spec [1] does not explicitly state that whitespace should be ignored here. However, other engines do ignore the whitespace; see test results at [2]. And the spec *does* say that whitespace should be ignored in aria-label [3]. So I think there's a good chance the spec will be changed for this. I filed a spec issue on this at [4]. That may take some time to resolve, so in the meantime I think the right thing to do is to align with the behavior of other browsers; hence this CL. [1] https://w3c.github.io/accname/#comp_labelledby [2] https://wpt.fyi/results/accname/name/comp_label.html?label=experimental&label=master&aligned&view=interop&q=label%3Ainterop-2024-accessibility [3] https://w3c.github.io/accname/#comp_label [4] w3c/accname#233 Bug: 338348441 Change-Id: Iffb623023e5ee3b903f2c243ae985efa5179135e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5540421 Reviewed-by: Aaron Leventhal <[email protected]> Reviewed-by: Benjamin Beaudry <[email protected]> Commit-Queue: Aaron Leventhal <[email protected]> Cr-Commit-Position: refs/heads/main@{#1302913}
If adding a step to strip the whitespace from the accumulated text so that it will correctly fall back to the aria-label, then we should add it. Do we think this is the case? |
I don't like that there's no way to force no name.
For example, if you have a title attribute on a <div>, and have that info
in another way, you might not want it to be converted to a name.
I had an example of this the other day, where the title was only there
because css text-ellipsis sometimes truncated things visibly (but not in
the a11y tree).
…On Thu, Jul 11, 2024 at 1:25 PM Melanie Sumner ***@***.***> wrote:
If adding a step to strip the whitespace from the accumulated text so that
it will correctly fall back to the aria-label, then we should add it.
Do we think this is the case?
—
Reply to this email directly, view it on GitHub
<#233 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKQAZRUCWSDS5ZYAH7HZYDZL25XPAVCNFSM6AAAAABEXCM77SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRTGQ4TEOBZG4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
IOW, IMO, aria-label="", aria-label=" " or aria-labelledby pointing to
empty/whitespace text should all cause there to be no name on something.
There can be reasons to do that.
On Thu, Jul 11, 2024 at 1:38 PM Aaron Leventhal ***@***.***>
wrote:
… I don't like that there's no way to force no name.
For example, if you have a title attribute on a <div>, and have that info
in another way, you might not want it to be converted to a name.
I had an example of this the other day, where the title was only there
because css text-ellipsis sometimes truncated things visibly (but not in
the a11y tree).
On Thu, Jul 11, 2024 at 1:25 PM Melanie Sumner ***@***.***>
wrote:
> If adding a step to strip the whitespace from the accumulated text so
> that it will correctly fall back to the aria-label, then we should add it.
>
> Do we think this is the case?
>
> —
> Reply to this email directly, view it on GitHub
> <#233 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAKQAZRUCWSDS5ZYAH7HZYDZL25XPAVCNFSM6AAAAABEXCM77SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRTGQ4TEOBZG4>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
|
I wonder if, because the whitespace is the result of formatted code (linebreaks and tabs/spaces), that kind of whitespace should be removed. Formatting whitespace (is there an existing formal/more correct name?) shouldn't add semantic meaning to anything. (FWIW, I've run into issues before just with HTML where code-formatting whitespace issues can make things not render, or not render correctly, in the browser, and it's super frustrating). Also,
|
IMO Chromium is correct and should not be failing a test here. The browser engine is what decides which whitespace from the source should be rendered. The a11y implementation faithfully represents what's rendered. You can see this if you change the button to a |
I'm looking at the test case
"button's hidden referenced name (visibility:hidden) with hidden aria-labelledby traversal falls back to aria-label"
in the WPT accname/name/comp_label.html.One problem is that the
span4
element ID is duplicated from the previous test; I'm fixing that in web-platform-tests/wpt#45117.In Chromium, the test still fails because Blink includes the whitespace under
span4
asspan4
's a contribution to the LabeledBy Recursion in step 2B LabeledBy. So we end up using that whitespace as the computed name, instead of falling back to thearia-label
, and the test fails.If I delete the whitespace under
span4
then the test passes.The spec language doesn't say anything here about not counting whitespace:
So per the spec, Chromium's behavior seems to be correct and the test incorrect, but I don't think that's the intent. Should the spec have a step to strip whitespace from the accumulated text in step iii before deciding whether not to return it?
The text was updated successfully, but these errors were encountered: