From 50e7e9f58dd19ce48b1e8002155742dc1778dffe Mon Sep 17 00:00:00 2001 From: sideshowbarker Date: Sun, 8 Dec 2024 15:54:31 +0900 Subject: [PATCH] =?UTF-8?q?LibWeb:=20Assign=20=E2=80=9Cdir=E2=80=9D,=20?= =?UTF-8?q?=E2=80=9Cdd=E2=80=9D,=20=E2=80=9Cdt=E2=80=9D=20default=20ARIA?= =?UTF-8?q?=20roles=20per-spec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also, import http://wpt.live/html-aam/dir-role.tentative.html (which provides test/regression coverage for the “dir” change). --- Libraries/LibWeb/HTML/HTMLElement.cpp | 9 ++++++ .../html-aam/dir-role.tentative.txt | 6 ++++ .../html-aam/dir-role.tentative.html | 28 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 Tests/LibWeb/Text/expected/wpt-import/html-aam/dir-role.tentative.txt create mode 100644 Tests/LibWeb/Text/input/wpt-import/html-aam/dir-role.tentative.html diff --git a/Libraries/LibWeb/HTML/HTMLElement.cpp b/Libraries/LibWeb/HTML/HTMLElement.cpp index cb3a9c62ea0..9428792102f 100644 --- a/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -740,6 +740,15 @@ Optional HTMLElement::default_role() const // https://www.w3.org/TR/html-aria/#el-code if (local_name() == TagNames::code) return ARIA::Role::code; + // https://w3c.github.io/html-aam/#el-dd + if (local_name() == TagNames::dd) + return ARIA::Role::definition; + // https://wpt.fyi/results/html-aam/dir-role.tentative.html + if (local_name() == TagNames::dir) + return ARIA::Role::list; + // https://w3c.github.io/html-aam/#el-dt + if (local_name() == TagNames::dt) + return ARIA::Role::term; // https://www.w3.org/TR/html-aria/#el-dfn if (local_name() == TagNames::dfn) return ARIA::Role::term; diff --git a/Tests/LibWeb/Text/expected/wpt-import/html-aam/dir-role.tentative.txt b/Tests/LibWeb/Text/expected/wpt-import/html-aam/dir-role.tentative.txt new file mode 100644 index 00000000000..4156b9fd290 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/html-aam/dir-role.tentative.txt @@ -0,0 +1,6 @@ +Harness status: OK + +Found 1 tests + +1 Pass +Pass el-dir \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/html-aam/dir-role.tentative.html b/Tests/LibWeb/Text/input/wpt-import/html-aam/dir-role.tentative.html new file mode 100644 index 00000000000..cc80c89969d --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/html-aam/dir-role.tentative.html @@ -0,0 +1,28 @@ + + + + HTML-AAM dir Element Role Verification Test + + + + + + + + + + +

Tentative test for the expected role mappings of the obsolete dir element. + The computedrole mappings are defined in HTML-AAM.

+ +

Merge the outcome of this test into roles.html in the appropriate alphabetical order, when it is no longer considered tentative:

+ +
  • x
  • x
  • + + + + + +