mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibWeb: Replace ARIA “synonym” roles with their preferred synonyms
This change does replacement of ARIA roles that have newer synonyms. There are a number of newer ARIA roles that are synonyms for older roles. https://wpt.fyi/results/wai-aria/role/synonym-roles.html has a number of subtests which expect that when retrieving the value of an explicitly- specified role attribute, if the value is one of the older role values, implementations must replace that with its newer synonym.
This commit is contained in:
parent
e9dedeee34
commit
695ce3763e
Notes:
github-actions[bot]
2024-12-20 13:46:50 +00:00
Author: https://github.com/sideshowbarker
Commit: 695ce3763e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2988
3 changed files with 60 additions and 0 deletions
|
@ -28,6 +28,20 @@ Optional<Role> ARIAMixin::role_from_role_attribute_value() const
|
|||
auto role = role_from_string(role_name);
|
||||
if (!role.has_value())
|
||||
continue;
|
||||
// NOTE: Per https://w3c.github.io/aria/#directory, "Authors are advised to treat directory as deprecated and to
|
||||
// use 'list'." Further, the "directory role == computedrole list" and "div w/directory role == computedrole
|
||||
// list" tests in https://wpt.fyi/results/wai-aria/role/synonym-roles.html expect "list", not "directory".
|
||||
if (role == Role::directory)
|
||||
return Role::list;
|
||||
// NOTE: The "image" role value is a synonym for the older "img" role value; however, the "synonym img role ==
|
||||
// computedrole image" test in https://wpt.fyi/results/wai-aria/role/synonym-roles.html expects "image", not "img".
|
||||
if (role == Role::img)
|
||||
return Role::image;
|
||||
// NOTE: Per https://w3c.github.io/aria/#presentation, "the working group introduced none as the preferred
|
||||
// synonym to the presentation role"; further, https://wpt.fyi/results/wai-aria/role/synonym-roles.html has a
|
||||
// "synonym presentation role == computedrole none" test that expects "none", not "presentation".
|
||||
if (role == Role::presentation)
|
||||
return Role::none;
|
||||
if (!is_abstract_role(*role))
|
||||
return *role;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue