-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
LibWeb: Compute accessible names for hidden/hidden-but-referenced nodes #2294
LibWeb: Compute accessible names for hidden/hidden-but-referenced nodes #2294
Conversation
610f287
to
6cac6d8
Compare
862716e
to
4c06624
Compare
Hello! One or more of the commit messages in this PR do not match the Ladybird code submission policy, please check the |
cf7b9dd
to
3e68e9d
Compare
29a6a58
to
3e92cde
Compare
Tests/LibWeb/Text/expected/wpt-import/accname/name/shadowdom/basic.txt
Outdated
Show resolved
Hide resolved
3e92cde
to
20fe6ba
Compare
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.
Have you opened spec issues about the problems you've found? There's a reasonable chance that we're the only project implementing it literally so the problems might not be known about.
Libraries/LibWeb/DOM/Element.cpp
Outdated
{ | ||
bool is_referenced = false; | ||
if (id().has_value()) { | ||
this->root().for_each_in_inclusive_subtree_of_type<HTML::HTMLElement>([&](auto& element) { |
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.
Not sure if this is important, but this loop will also iterate over this element. Should an element referencing itself behave the same as a different element referencing it?
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.
Also nit-pick: I don't think you need the this->
here.
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.
Not sure if this is important, but this loop will also iterate over this element. Should an element referencing itself behave the same as a different element referencing it?
I don’t now recall intentionally choosing for_each_in_inclusive_subtree_of_type
rather than for_each_in_subtree_of_type
and I don’t believe the spec requirements necessitate that, and changing it doesn’t cause any tests to fail — so I’ve gone ahead and changed it to using for_each_in_subtree_of_type
.
20fe6ba
to
7cc65bc
Compare
Yes, I’ve opened both a spec issue and several spec PRs. |
7cc65bc
to
e07be89
Compare
Actually, it seems I’d missed a few — but I’ve now added links to the additional ones in the code comments. |
This change implements full support for the “A. Hidden Not Referenced” step at https://w3c.github.io/accname/#step2A in the “Accessible Name and Description Computation” spec — including handling all hidden nodes that must be ignored, as well as handling hidden nodes that, for the purposes of accessible-name computation, must not be ignored (due to having aria-labelledby/aria-describedby references from other nodes). Otherwise, without this change, not all cases of hidden nodes get ignored as expected, while cases of nodes that are hidden but that have aria-labelledby/aria-describedby references from other nodes get unexpectedly ignored.
This change makes Ladybird give the value of the aria-label attribute the correct precedence for accessible-name computation required by the “Accessible Name and Description Computation” and HTML-AAM specs and by the corresponding WPT tests. Otherwise, without this change, Ladybird fails some of the WPT subtests of the test at https://wpt.fyi/results/accname/name/comp_label.html.
e07be89
to
b775866
Compare
I think I’ve responded to (and hopefully resolved) all the review comments received on this so far. But if I missed anything, please let me know |
This change implements full support for the “A. Hidden Not Referenced” step at https://w3c.github.io/accname/#step2A in the “Accessible Name and Description Computation” spec — including handling all hidden nodes that must be ignored, as well as handling hidden nodes that, for the purposes of accessible-name computation, must not be ignored (due to having
aria-labelledby
/aria-describedby
references from other nodes).Otherwise, without this change, not all cases of hidden nodes get ignored as expected, while cases of nodes that are hidden but that have
aria-labelledby
/aria-describedby
references from other nodes get unexpectedly ignored.For the tests at https://wpt.fyi/results/accname/name?product=ladybird, this change gets us passing:
comp_labelledby_hidden_nodes.html
testcomp_hidden_not_referenced.html
testOtherwise, without this change, we fail all those tests.
Additionally, a separate commit here makes us give the value of the aria-label attribute the correct precedence for accessible-name computation required by the “Accessible Name and Description Computation” and HTML-AAM specs and by the corresponding WPT tests.
That gets us passing all 131 subtests in the
comp_label.html
test at https://wpt.fyi/results/accname/name?product=ladybird