Skip to content
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

Updated spec text to reflect the processing of hidden elements when c… #137

Closed
wants to merge 7 commits into from

Conversation

accdc
Copy link
Contributor

@accdc accdc commented Aug 6, 2021

…omputing description to match intent as discussed.

Closes #57


Preview | Diff

…omputing description to match intent as discussed.
@cookiecrook
Copy link
Contributor

cookiecrook commented Aug 19, 2021

I find this line very difficult to parse:

If computing a name, or if computing a description and the current node is not hidden, compute the text alternative of the current node beginning with step 2. If computing a description and the current node is hidden, however, compute the text alternative of the current node by returning its inner text content. Set the result to that text alternative.

I tried rewriting it for clarity:

Compute the text alternative using the following steps:

  • When computing a name, compute the text alternative of the current node beginning with step 2 (this should point to a named step rather than a numbered step).
  • When computing a description:
    • If the current node is not hidden, compute the text alternative of the current node beginning with step 2 (ditto re: numbered step).
    • If the current node is hidden, compute the text alternative of the current node by returning the value of element.innerText.

Set the result to that text alternative.

The last line isn't changed as part of this PR, but it could benefit from further clarification too.

@jnurthen
Copy link
Member

Referencing {{HTMLElement/innerText}} will reference innerText in the HTML spec

Copy link
Contributor

@cookiecrook cookiecrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@accdc Assuming you accept my editorial change proposal of your prose, and @aleventhal's suggestion to simplify (keeping this step the same for both name and description), then I will float this proposal further with other WebKit engineers. The accessibility engineers have already reviewed, but there are more stakeholders wrt innerText.

Notes:

Copy link
Contributor

@cookiecrook cookiecrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the change proposal didn't come through the first time.

index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
@cookiecrook
Copy link
Contributor

FWIW, I removed my "approved" review, since I rewrote a significant portion of this change, but if we get two other reviewers, I think it looks okay.

Copy link
Contributor

@aleventhal aleventhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there might be two places that we need to mention aria-label? There's another place that is adding the innerText language, but it doesn't mention aria-label yet.

@aleventhal
Copy link
Contributor

Looks good with @cookiecrook 's change.

@cookiecrook
Copy link
Contributor

cookiecrook commented Sep 2, 2021

Looks like there might be two places that we need to mention aria-label? There's another place that is adding the innerText language, but it doesn't mention aria-label yet.

I think it's just on Line 274. Where else are you seeing it?

@jnurthen
Copy link
Member

jnurthen commented Sep 9, 2021

@jcsteh - can you please take a look at this

@jcsteh
Copy link

jcsteh commented Sep 13, 2021

Name/description calculation hurts my head. 🤯

Overall, I agree this simplifies things and makes sense for that reason. One thing that occurs to me: while the differences in output when descendants use different methods of hiding have been discussed, there will also be significant differences when the target node itself uses different methods of hiding. For example:

<div id="label" hidden>
  visible <span hidden>hidden</span>
</div>
<button aria-labelledby="label"></button>

Button label will be "visible hidden"

<div id="label" style="visibility: hidden;">
  visible <span hidden>hidden</span>
</div>
<button aria-labelledby="label"></button>

Button label will be ""

<div id="label" aria-hidden="true">
  visible <span hidden>hidden</span>
</div>
<button aria-labelledby="label"></button>

Button label will be "visible"

Currently, Firefox returns the same label for all of these: "visible hidden"

That said, I guess this is pretty similar to the "maybe not what authors expect" situation for descendants and consensus seems to be that this is an acceptable compromise. I just thought it worth raising in case it hadn't been considered yet (and is worthy of separate consideration).

@aleventhal
Copy link
Contributor

We found something that might be a problem. In this example, only the display:none has an innerText, but I would have expected visibility:hidden innerText to remain intact.

<div id="dn" style="display:none">disp-none</div>
<div id="vh" style="visibility:hidden">visi-hidden</div>

Therefore, this PR will break labels where authors thought that visibility:hidden was an acceptable way to hide a label.

Copy link
Contributor

@aleventhal aleventhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing my approval until we discuss the fact that visibilitity:hidden on the target of an aria-labelledby will lead to an empty name.

@accdc
Copy link
Contributor Author

accdc commented Sep 13, 2021

Thanks for the heads up. I'm not sure if it is possible to resurrect, we will need to talk it over at the next meeting. I may not be available for the one on the 16th due to a conflict though.

Copy link
Member

@jnurthen jnurthen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would these changes fix the visibility:hidden issue - it uses the same text from HTML to determine if something is rendered so would only use innerText for those usages.

index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
cookiecrook and others added 2 commits September 20, 2021 17:04
Co-authored-by: James Nurthen <[email protected]>
Co-authored-by: James Nurthen <[email protected]>
Copy link

@jcsteh jcsteh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this change means that we still need to handle ARIA attributes, etc. in visibility: hidden targets of aria-labell/describedby? For example:

<div id="l3" hidden>l3</div>
<div id="label" style="visibility: hidden;">
  l1
  <span aria-hidden="hidden">l2</span>
  <span aria-labelledby="l3"></span>
</div>
<button aria-labelledby="label"></button>

If I read this right, the expected label for the button is "l1 l3". in Firefox, that's tricky because visibility: hidden subtrees get removed from the a11y tree. That's not a new bug - we need to fix it to fully comply with the current spec too - but I wanted to clarify the intent here.

On the other hand, if you do this:

<div id="l3" hidden>l3</div>
<div id="label">
  <span style="visibility: hidden;">
    l1
    <span aria-hidden="hidden">l2</span>
    <span aria-labelledby="l3"></span>
  </span>
</div>
<button aria-labelledby="label"></button>

If I read this right, the expected label for the button will be empty, since we don't differentiate "being rendered" from "hidden" except for direct targets of aria-labell/describedby.

index.html Outdated Show resolved Hide resolved
Co-authored-by: James Teh <[email protected]>
@cookiecrook
Copy link
Contributor

@jcsteh I'm not sure if you are expressing a block/concern in there, or if you are just noting potential implementation complexity.

@jcsteh
Copy link

jcsteh commented Sep 28, 2021

@jcsteh I'm not sure if you are expressing a block/concern in there, or if you are just noting potential implementation complexity.

Sorry. Allow me to clarify:

  1. I'm seeking to make sure that my understanding is correct; i.e. that the test cases I provided yield the results I expect.
  2. I'm now a little lost as to the purpose of this change. When the proposal was to use innerText for all "hidden" targets, my understanding was that it simplified things (and was feasible to implement) across all implementations. As it stands now, that benefit is lost (because building a text alternative from a DOM subtree which isn't part of the a11y tree is complex and not well understood). So, what are we trying to solve here now?

@cookiecrook
Copy link
Contributor

cookiecrook commented Sep 28, 2021

@jcsteh I believe your understanding is correct. The follow up change was proposed by @aleventhal to account for an authoring practice he anticipates may cause breakage if we used innerText without exception.

I think both Aaron’s and Jamie’s points have merit, but they are at odds with each other. The HTML Priority of Constituencies urges us to regard Authors over Implementors in this scenario, but at what point does increased implementation complexity outweigh the perceived authoring benefit? Maybe a compromise can be reached.

Perhaps this topic is worthy of more follow-up discussion at an upcoming ARIA meeting. Ideally, @accdc, @joanmarie, @jcsteh, and @aleventhal should attend. I’d like to be there too.

@jongund
Copy link

jongund commented Sep 28, 2021

This has been a very informative discussion, but I hope any final solution will error on the side of simplicity and making it easier for authors to understand of how to use aria-labelledby and aria-describedby to solve accessibility design issues. I urge careful consideration of keeping existing computational complexity just because of potential legacy usage and the problems with legacy user agent regression tests failing.

@aleventhal
Copy link
Contributor

Is this proposal dead now?
At least for Chrome, we no longer need it. We found a way to work around our acc name implementation's complexity and follow the current spec without using innerText.

@accdc
Copy link
Contributor Author

accdc commented Nov 4, 2021

test.zip

@accdc
Copy link
Contributor Author

accdc commented Nov 4, 2021

As we spoke of earlier, I've attached an example that would need to be solvable by whatever we decide for this issue going forward.

@cookiecrook
Copy link
Contributor

@aleventhal wrote:

Is this proposal dead now?

No. From the ARIA call (last week IIRC?), we left this with Aaron to make a change suggestion on the PR that either didn't include innerText, or had some more exceptions to the innerText option.

@jnurthen
Copy link
Member

jnurthen commented Feb 2, 2022

@aleventhal should this be closed now?

@jnurthen
Copy link
Member

jnurthen commented Feb 3, 2022

Discussed in Feb 3 2022 call. Closing as overcome

@jnurthen jnurthen closed this Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When is hidden content taken into calculation of name and description?
8 participants