mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibWeb: Compute roles for SVG graphics-symbol elements and foreignObject
This change adds computation of ARIA roles for a number of SVG elements for which, if the element meets the SVG spec criteria for inclusion in the accessibility tree, the computed ARIA role should be “graphics-symbol”, and should otherwise be “generic”. This change also adds similar role computation for the SVG foreignObject element (the role for which, if the element meets the SVG spec criteria for inclusion in the accessibility tree, should be “group”, and should otherwise be “generic”).
This commit is contained in:
parent
8961d5d2ce
commit
2983a17ea6
Notes:
github-actions[bot]
2024-12-28 01:17:12 +00:00
Author: https://github.com/sideshowbarker
Commit: 2983a17ea6
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3043
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/trflynn89
3 changed files with 64 additions and 2 deletions
|
@ -55,11 +55,17 @@ Optional<ARIA::Role> SVGElement::default_role() const
|
|||
// https://w3c.github.io/svg-aam/#mapping_role_table
|
||||
if (local_name() == TagNames::a && (has_attribute(SVG::AttributeNames::href) || has_attribute(AttributeNames::xlink_href)))
|
||||
return ARIA::Role::link;
|
||||
if (local_name() == TagNames::g && should_include_in_accessibility_tree())
|
||||
if (local_name().is_one_of(TagNames::foreignObject, TagNames::g)
|
||||
&& should_include_in_accessibility_tree())
|
||||
return ARIA::Role::group;
|
||||
if (local_name() == TagNames::image && should_include_in_accessibility_tree())
|
||||
return ARIA::Role::image;
|
||||
return {};
|
||||
if (local_name() == TagNames::circle && should_include_in_accessibility_tree())
|
||||
return ARIA::Role::graphicssymbol;
|
||||
if (local_name().is_one_of(TagNames::ellipse, TagNames::path, TagNames::polygon, TagNames::polyline)
|
||||
&& should_include_in_accessibility_tree())
|
||||
return ARIA::Role::graphicssymbol;
|
||||
return ARIA::Role::generic;
|
||||
}
|
||||
|
||||
void SVGElement::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
Harness status: OK
|
||||
|
||||
Found 9 tests
|
||||
|
||||
9 Pass
|
||||
Pass el-circle
|
||||
Pass el-ellipse
|
||||
Pass el-foreignObject
|
||||
Pass el-g
|
||||
Pass el-line
|
||||
Pass el-path
|
||||
Pass el-polygon
|
||||
Pass el-polyline
|
||||
Pass el-rect
|
|
@ -0,0 +1,42 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>SVG-AAM Generic 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 ONLY the default <code>generic</code> mappings defined in <a href="https://w3c.github.io/svg-aam/#include_elements">SVG-AAM: 5.1.2 Including Elements in the Accessibility Tree</a>.</p>
|
||||
|
||||
<h2>Simple Elements</h2>
|
||||
<!-- Note: adding an inoccuous label, tabindex, or some other accessible marker may cause the computedrole result to change. -->
|
||||
<svg>
|
||||
<!-- Some elements skipped: never-rendered elements can return unpredicable/undefined/unspecified values for computedrole. -->
|
||||
<circle data-testname="el-circle" class="ex-generic"></circle>
|
||||
<ellipse data-testname="el-ellipse" class="ex-generic"></ellipse>
|
||||
<foreignObject data-testname="el-foreignObject" class="ex-generic"></foreignObject>
|
||||
<g data-testname="el-g" class="ex-generic"></g>
|
||||
<!-- image -> in ./role-img.tentative.html -->
|
||||
<line data-testname="el-line" class="ex-generic"></line>
|
||||
<!-- skipped: mesh -->
|
||||
<path data-testname="el-path" class="ex-generic"></path>
|
||||
<polygon data-testname="el-polygon" class="ex-generic"></polygon>
|
||||
<polyline data-testname="el-polyline" class="ex-generic"></polyline>
|
||||
<rect data-testname="el-rect" class="ex-generic"></rect>
|
||||
<!-- blocked: textPath -> https://w3c.github.io/svg-aam/#textpath-tspan-mappings-issue-->
|
||||
<!-- blocked: tspan -> https://w3c.github.io/svg-aam/#textpath-tspan-mappings-issue -->
|
||||
<!-- skipped: use -->
|
||||
</svg>
|
||||
|
||||
<script>
|
||||
AriaUtils.verifyGenericRolesBySelector(".ex-generic");
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue