Skip to content

Commit

Permalink
Remove implicit "document" role on body and add it to html (#718)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>
  • Loading branch information
calebeby and eps1lon committed Aug 5, 2021
1 parent 0c2bdea commit 6154760
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/silver-peas-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"dom-accessibility-api": patch
---

Remove implicit "document" role on `<body>` and add it to `<html>`
4 changes: 2 additions & 2 deletions sources/__tests__/getRole.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const cases = [
["audio", null, createElementFactory("audio", {})],
["base", null, createElementFactory("base", {})],
["blockquote", null, createElementFactory("blockquote", {})],
["body", "document", createElementFactory("body", {})],
["body", null, createElementFactory("body", {})],
["button", "button", createElementFactory("button", {})],
["canvas", null, createElementFactory("canvas", {})],
["caption", null, createElementFactory("caption", {})],
Expand Down Expand Up @@ -86,7 +86,7 @@ const cases = [
["header", "banner", createElementFactory("header", {})],
["hgroup", null, createElementFactory("hgroup", {})],
["hr", "separator", createElementFactory("hr", {})],
["html", null, createElementFactory("html", {})],
["html", "document", createElementFactory("html", {})],
["iframe", null, createElementFactory("iframe", {})],
["img with alt=\"some text\"", "img", createElementFactory("img", {alt: "text"})],
["img with missing alt", "img", createElementFactory("img", {})],
Expand Down
2 changes: 1 addition & 1 deletion sources/getRole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { getLocalName } from "./util";
const localNameToRoleMappings: Record<string, string | undefined> = {
article: "article",
aside: "complementary",
body: "document",
button: "button",
datalist: "listbox",
dd: "definition",
Expand All @@ -25,6 +24,7 @@ const localNameToRoleMappings: Record<string, string | undefined> = {
h6: "heading",
header: "banner",
hr: "separator",
html: "document",
legend: "legend",
li: "listitem",
math: "math",
Expand Down

0 comments on commit 6154760

Please sign in to comment.