-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
Only add aria-hidden for scale
mode
#501
Conversation
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.
Gentle ping to @gabalafou could you please review this one?
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.
Hi @krassowski, thanks for working on this!
I'm not sure I entirely agree with MDN that aria-hidden should not be added when an element has the hidden
attribute, or display: none
, or visibility: hidden
. And the reason is precisely because of content-visibility
. As far as I understand, if you style some offscreen node with content-visibility: auto
, but inside that node you have a node that is hidden (via display: none
or visibility: hidden
), then the hidden node will still appear in the accessibility tree, which is most likely undesired. For example:
<style>
.offscreen {
content-visibility: auto;
}
.hidden {
display: none;
}
</style>
<div>Above the fold</div>
<div class="offscreen">
Below the fold.
<div class="hidden">Hide this content.</div>
</div>
When the above page first loads and the user hasn't scrolled down, then "Hide this content" will appear in the accessibility tree, correct?
Why does the browser have to do a style recalculation when changing the aria-hidden value? Is it because the aria-hidden value can be targeted by CSS via the [aria-hidden]
attribute selector?
My other question is, since we're already changing properties on the widget's node when we call show/hide, why does changing aria-hidden at the same time cause additional work? Is it because the browser has to do the style recalculation at the exact moment that we call set/removeAttribute? Is there any way to batch together the node property changes?
One last question, how could I test this across browsers? Just so I understand what the desired behavior is, whenever we have a widget, no matter what HiddenMode
it uses, when we call hide on that widget, its node should be removed from the accessibility tree, and when we call show, it should be added to the accessibility tree? Is that right?
Sorry if some of the above doesn't make sense. I had to type it up hastily. Again, thanks for working on this and please let me know how I can help. Happy to write tests or check this functionality on other browsers. Just let me know, thanks! 😄
We are not using
Yes. Some browsers (see Firefox) have very good heuristics for avoiding doing so when not needed, others don't.
Because browsers have fast paths (optimized code) to handle changes of some attributes or scenarios but not for others. We want to make as little DOM changes which invalidate the style cache as possible to trigger as many fast paths as possible.
No. Yes, browsers do batch the style recalculation and layout operations together automatically. In general if you want to learn more see this course.
Yes, this is right. You would need to modify the DOM manually to test it at the moment (until we release). |
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.
Thanks @krassowski
I let you merge if you think it is ok.
Fixes #499. I would appreciate a review from someone working on accessibility.