mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-13 22:01:53 +00:00
LibWeb: Support the “image” synonym for the “img” ARIA role
Additionally: For “img” elements with empty “alt” attributes, change the default role to the newer, preferred “none” synonym for the older “presentation” role; import https://wpt.fyi/results/html-aam/roles.html (which provides test/regression coverage for these changes).
This commit is contained in:
parent
6e24f23aa0
commit
ccbc436e85
Notes:
github-actions[bot]
2024-12-12 13:14:53 +00:00
Author: https://github.com/sideshowbarker
Commit: ccbc436e85
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2836
Reviewed-by: https://github.com/trflynn89
5 changed files with 282 additions and 2 deletions
|
@ -411,10 +411,15 @@ Optional<ARIA::Role> HTMLImageElement::default_role() const
|
|||
{
|
||||
// https://www.w3.org/TR/html-aria/#el-img
|
||||
// https://www.w3.org/TR/html-aria/#el-img-no-alt
|
||||
// https://w3c.github.io/aria/#image
|
||||
// NOTE: The "image" role value is a synonym for the older "img" role value; however, the el-img test in
|
||||
// https://wpt.fyi/results/html-aam/roles.html expects the value to be "image" (not "img").
|
||||
if (!alt().is_empty())
|
||||
return ARIA::Role::img;
|
||||
return ARIA::Role::image;
|
||||
// https://www.w3.org/TR/html-aria/#el-img-empty-alt
|
||||
return ARIA::Role::presentation;
|
||||
// NOTE: The "none" role value is a synonym for the older "presentation" role value; however, the el-img-alt-no-value
|
||||
// test in https://wpt.fyi/results/html-aam/roles.html expects the value to be "none" (not "presentation").
|
||||
return ARIA::Role::none;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/images.html#use-srcset-or-picture
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue