diff --git a/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Libraries/LibWeb/HTML/HTMLInputElement.cpp index d3696c8cb21..bec7f08eeb1 100644 --- a/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -2355,8 +2355,12 @@ Optional HTMLInputElement::default_role() const if (type_state() == TypeAttributeState::Button) return ARIA::Role::button; // https://www.w3.org/TR/html-aria/#el-input-checkbox - if (type_state() == TypeAttributeState::Checkbox) + if (type_state() == TypeAttributeState::Checkbox) { + // https://github.com/w3c/html-aam/issues/496 + if (has_attribute("switch"_string)) + return ARIA::Role::switch_; return ARIA::Role::checkbox; + } // https://www.w3.org/TR/html-aria/#el-input-email if (type_state() == TypeAttributeState::Email && !has_attribute(AttributeNames::list)) return ARIA::Role::textbox; diff --git a/Tests/LibWeb/Text/expected/wpt-import/html-aam/roles.tentative.txt b/Tests/LibWeb/Text/expected/wpt-import/html-aam/roles.tentative.txt new file mode 100644 index 00000000000..85354c236f8 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/html-aam/roles.tentative.txt @@ -0,0 +1,9 @@ +Harness status: OK + +Found 4 tests + +4 Pass +Pass el-input-checkbox-switch +Pass el-thead +Pass el-tbody +Pass el-tfoot \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/html-aam/roles.tentative.html b/Tests/LibWeb/Text/input/wpt-import/html-aam/roles.tentative.html new file mode 100644 index 00000000000..812c72991ea --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/html-aam/roles.tentative.html @@ -0,0 +1,59 @@ + + + + HTML-AAM Role Verification Tests + + + + + + + + + + +

Tests the computedrole mappings defined in HTML-AAM. Most test names correspond to a unique ID defined in the spec.

+ +

These should remain in alphabetical order, and include all HTML tagnames. If a tag is not tested here, include a pointer to the file where it is tested, such as: <!-- caption -> ./table-roles.html -->

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
abc
123
456
xyz
+ + + + +