diff --git a/Libraries/LibWeb/SVG/SVGElement.cpp b/Libraries/LibWeb/SVG/SVGElement.cpp index 583b9ad2709..9a049afa3c4 100644 --- a/Libraries/LibWeb/SVG/SVGElement.cpp +++ b/Libraries/LibWeb/SVG/SVGElement.cpp @@ -55,11 +55,17 @@ Optional 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) diff --git a/Tests/LibWeb/Text/expected/wpt-import/svg-aam/role/roles-generic.txt b/Tests/LibWeb/Text/expected/wpt-import/svg-aam/role/roles-generic.txt new file mode 100644 index 00000000000..65fd60af2b4 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/svg-aam/role/roles-generic.txt @@ -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 \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/svg-aam/role/roles-generic.html b/Tests/LibWeb/Text/input/wpt-import/svg-aam/role/roles-generic.html new file mode 100644 index 00000000000..6386e8a6397 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/svg-aam/role/roles-generic.html @@ -0,0 +1,42 @@ + + + + SVG-AAM Generic Role Verification Tests + + + + + + + + + + +

Tests ONLY the default generic mappings defined in SVG-AAM: 5.1.2 Including Elements in the Accessibility Tree.

+ +

Simple Elements

+ + + + + + + + + + + + + + + + + + + + + + +