mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 17:24:48 -05:00
LibWeb: Fix internal logic for recognizing non-abstract ARIA roles
This commit is contained in:
parent
af3d46dc06
commit
ce65457746
Notes:
github-actions[bot]
2024-12-18 15:25:50 +00:00
Author: https://github.com/sideshowbarker Commit: https://github.com/LadybirdBrowser/ladybird/commit/ce654577463 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2964 Reviewed-by: https://github.com/AtkinsSJ ✅
7 changed files with 76 additions and 11 deletions
|
@ -28,7 +28,7 @@ Optional<Role> ARIAMixin::role_from_role_attribute_value() const
|
|||
auto role = role_from_string(role_name);
|
||||
if (!role.has_value())
|
||||
continue;
|
||||
if (is_non_abstract_role(*role))
|
||||
if (!is_abstract_role(*role))
|
||||
return *role;
|
||||
}
|
||||
|
||||
|
|
|
@ -173,15 +173,6 @@ bool is_windows_role(Role role)
|
|||
Role::dialog);
|
||||
}
|
||||
|
||||
bool is_non_abstract_role(Role role)
|
||||
{
|
||||
return is_widget_role(role)
|
||||
|| is_document_structure_role(role)
|
||||
|| is_landmark_role(role)
|
||||
|| is_live_region_role(role)
|
||||
|| is_windows_role(role);
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/wai-aria-1.2/#namefromcontent
|
||||
bool allows_name_from_content(Role role)
|
||||
{
|
||||
|
|
|
@ -128,7 +128,6 @@ bool is_landmark_role(Role);
|
|||
bool is_live_region_role(Role);
|
||||
bool is_windows_role(Role);
|
||||
|
||||
bool is_non_abstract_role(Role);
|
||||
bool allows_name_from_content(Role);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
Harness status: OK
|
||||
|
||||
Found 2 tests
|
||||
|
||||
2 Pass
|
||||
Pass role is sectionfooter (in main)
|
||||
Pass role is sectionheader (in main)
|
|
@ -0,0 +1,7 @@
|
|||
Harness status: OK
|
||||
|
||||
Found 2 tests
|
||||
|
||||
2 Pass
|
||||
Pass role: sectionheader
|
||||
Pass role: sectionfooter
|
|
@ -0,0 +1,30 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Tentative: Contextual Role Verification Tests</title>
|
||||
<script src="../../resources/testharness.js"></script>
|
||||
<script src="../../resources/testharnessreport.js"></script>
|
||||
<script src="../../resources/testdriver.js"></script>
|
||||
<script src="../../resources/testdriver-vendor.js"></script>
|
||||
<script src="../../resources/testdriver-actions.js"></script>
|
||||
<script src="../../wai-aria/scripts/aria-utils.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!--
|
||||
New sectionheader and sectionfooter roles.
|
||||
See https://github.com/w3c/aria/pull/1931
|
||||
-->
|
||||
<main>
|
||||
<div role="sectionfooter" data-testname="role is sectionfooter (in main)" data-expectedrole="sectionfooter" class="ex">x</div>
|
||||
</main>
|
||||
<main>
|
||||
<div role="sectionheader" data-testname="role is sectionheader (in main)" data-expectedrole="sectionheader" class="ex">x</div>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
AriaUtils.verifyRolesBySelector(".ex");
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,31 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>New Core ARIA Role Verification Tests</title>
|
||||
<script src="../../resources/testharness.js"></script>
|
||||
<script src="../../resources/testharnessreport.js"></script>
|
||||
<script src="../../resources/testdriver.js"></script>
|
||||
<script src="../../resources/testdriver-vendor.js"></script>
|
||||
<script src="../../resources/testdriver-actions.js"></script>
|
||||
<script src="../../wai-aria/scripts/aria-utils.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Tests new <a href="https://w3c.github.io/aria/#role_definitions">ARIA role definitions</a>. See comments for more info.</p>
|
||||
|
||||
<script>
|
||||
|
||||
/*
|
||||
|
||||
Tests simple role assignment: <div role="alert">x</div>
|
||||
|
||||
*/
|
||||
|
||||
AriaUtils.assignAndVerifyRolesByRoleNames([
|
||||
"sectionheader", // See ARIA pull #1931
|
||||
"sectionfooter", // See ARIA pull #1931
|
||||
]);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue