mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Ignore name-required landmark roles which lack accessible names
This change implements the role-checking requirement from the ARIA spec at https://w3c.github.io/aria/#document-handling_author-errors_roles that the “form” and “region” roles are required to have accessible names — and that if they don’t have accessible names as required, UAs must treat them as if they’d not been specified at all.
This commit is contained in:
parent
2cb7baa581
commit
ead3af0163
Notes:
github-actions[bot]
2025-01-09 14:09:37 +00:00
Author: https://github.com/sideshowbarker
Commit: ead3af0163
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2972
Reviewed-by: https://github.com/AtkinsSJ ✅
7 changed files with 151 additions and 0 deletions
|
@ -130,6 +130,14 @@ Optional<Role> ARIAMixin::role_from_role_attribute_value() const
|
|||
}
|
||||
continue;
|
||||
}
|
||||
// https://w3c.github.io/aria/#document-handling_author-errors_roles
|
||||
// Certain landmark roles require names from authors. In situations where an author has not specified names for
|
||||
// these landmarks, it is considered an authoring error. The user agent MUST treat such elements as if no role
|
||||
// had been provided. If a valid fallback role had been specified, or if the element had an implicit ARIA role,
|
||||
// then user agents would continue to expose that role, instead.
|
||||
if ((role == ARIA::Role::form || role == ARIA::Role::region)
|
||||
&& to_element()->accessible_name(to_element()->document(), DOM::ShouldComputeRole::No).value().is_empty())
|
||||
continue;
|
||||
// 4. Use the first such substring in textual order that matches the name of a non-abstract WAI-ARIA role.
|
||||
if (!is_abstract_role(*role))
|
||||
return *role;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue