mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 17:28:30 +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:
committed by
Tim Flynn
parent
6e24f23aa0
commit
ccbc436e85
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user