Skip to content

Commit dbd327e

Browse files
committed
fix: dual run aria-query and html-aria for dpub spec support
1 parent 0eeccd4 commit dbd327e

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

src/getNodeAccessibilityData/getAccessibleAttributeLabels/getAttributesByRole.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export const getAttributesByRole = ({
1010
accessibleValue: string;
1111
role: string;
1212
}): [string, string | null][] => {
13+
// TODO: swap out with the html-aria package if implicit role attributes
14+
// become supported.
1315
const {
1416
props: implicitRoleAttributes = {},
1517
prohibitedProps: prohibitedAttributes = [],

src/getNodeAccessibilityData/getRole.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
import {
22
type AncestorList,
33
getRole as getImplicitRole,
4+
roles,
45
type TagName,
56
type VirtualElement,
67
} from "html-aria";
8+
import { roles as backupRoles } from "aria-query";
79
import { getLocalName } from "../getLocalName";
810
import { isElement } from "../isElement";
9-
import { roles } from "aria-query";
1011

1112
export const presentationRoles = new Set(["presentation", "none"]);
1213

13-
const allowedNonAbstractRoles = new Set(
14-
roles
14+
const allowedNonAbstractRoles = new Set([
15+
...(Object.entries(roles)
16+
.filter(([, { type }]) => !type.includes("abstract"))
17+
.map(([key]) => key) as string[]),
18+
// TODO: remove once the `html-aria` package supports `dpub-aam` /
19+
// `dpub-aria` specifications.
20+
...(backupRoles
1521
.entries()
1622
.filter(([, { abstract }]) => !abstract)
17-
.map(([key]) => key) as string[]
18-
);
23+
.map(([key]) => key) as string[]),
24+
]);
1925

2026
const rolesRequiringName = new Set(["form", "region"]);
2127

src/getNodeAccessibilityData/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { getAccessibleName } from "./getAccessibleName";
55
import { getAccessibleValue } from "./getAccessibleValue";
66
import { isElement } from "../isElement";
77

8+
// TODO: swap out with the html-aria package if this property becomes supported.
89
const childrenPresentationalRoles = new Set(
910
roles
1011
.entries()

test/wpt-jsdom/to-run.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ aria-valuetext_value_changes-manual.html:
279279
]
280280
combobox-value-calculation-manual.html:
281281
[timeout, value taken from text content not implemented]
282-
comment-manual.html: [timeout, upstream issue with html-aria package]
283282
deletion-manual.html: [fail, syntax error in test - fix needed in WPT]
284283
exclude_element_hidden_with_*:
285284
[
@@ -302,7 +301,6 @@ heading-no-level-manual.html:
302301
skip,
303302
targets accessibility APIs whose mappings have not been implemented in this test suite yet,
304303
]
305-
image-manual.html: [timeout, upstream issue with html-aria package]
306304
include_element_*:
307305
[
308306
skip,
@@ -336,6 +334,7 @@ tablist-level-not-supported-manual.html:
336334
skip,
337335
targets accessibility APIs whose mappings have not been implemented in this test suite yet,
338336
]
337+
339338
---
340339
DIR: dpub-aam
341340

@@ -455,14 +454,10 @@ role/menu-roles.tentative.html:
455454
[fail, upstream issue with html-aria package]
456455
"orphan button with menuitemradio role":
457456
[fail, upstream issue with html-aria package]
458-
role/roles.html:
459-
"role: suggestion": [fail, upstream issue with html-aria package]
460457
role/roles.tentative.html:
461458
"role: sectionheader": [fail, upstream issue with html-aria package]
462459
"role: sectionfooter": [fail, upstream issue with html-aria package]
463460
role/synonym-roles.html:
464-
"image role == computedrole image":
465-
[fail, upstream issue with html-aria packages]
466461
"synonym img role == computedrole image":
467462
[fail, upstream issue with html-aria packages]
468463
"directory role == computedrole list":

0 commit comments

Comments
 (0)