Skip to content

Commit 9f87084

Browse files
committed
fix: add missing aria element properties
1 parent 12756b7 commit 9f87084

File tree

5 files changed

+65
-18
lines changed

5 files changed

+65
-18
lines changed

.changeset/sour-seas-fail.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"element-internals-polyfill": patch
3+
---
4+
5+
Added missing aria properties

package-lock.json

Lines changed: 34 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@rollup/plugin-node-resolve": "^7.1.3",
5656
"@rollup/plugin-typescript": "^6.0.0",
5757
"@types/mocha": "^10.0.1",
58+
"@types/node": "^24.5.0",
5859
"@web/dev-server-esbuild": "^0.3.3",
5960
"@web/test-runner": "^0.15.0",
6061
"@web/test-runner-playwright": "^0.9.0",
@@ -80,6 +81,6 @@
8081
"sinon": "^9.2.4",
8182
"standard-version": "^9.0.0",
8283
"tslib": "^2.1.0",
83-
"typescript": "^5.5.4"
84+
"typescript": "^5.9.2"
8485
}
8586
}

src/aom.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import { upgradeMap } from "./maps.js";
22
import { setAttribute } from "./utils.js";
33
import "./types.js";
44

5-
export const aom: Record<keyof ARIAMixin, string> = {
5+
const PROPERTY_ONLY = Symbol("PROPERTY_ONLY");
6+
7+
export const aom: Record<keyof ARIAMixin, string | symbol> = {
8+
ariaActiveDescendantElement: PROPERTY_ONLY,
69
ariaAtomic: "aria-atomic",
710
ariaAutoComplete: "aria-autocomplete",
811
ariaBrailleLabel: "aria-braillelabel",
@@ -13,21 +16,28 @@ export const aom: Record<keyof ARIAMixin, string> = {
1316
ariaColIndex: "aria-colindex",
1417
ariaColIndexText: "aria-colindextext",
1518
ariaColSpan: "aria-colspan",
19+
ariaControlsElements: PROPERTY_ONLY,
1620
ariaCurrent: "aria-current",
21+
ariaDescribedByElements: PROPERTY_ONLY,
1722
ariaDescription: "aria-description",
23+
ariaDetailsElements: PROPERTY_ONLY,
1824
ariaDisabled: "aria-disabled",
25+
ariaErrorMessageElements: PROPERTY_ONLY,
1926
ariaExpanded: "aria-expanded",
27+
ariaFlowToElements: PROPERTY_ONLY,
2028
ariaHasPopup: "aria-haspopup",
2129
ariaHidden: "aria-hidden",
2230
ariaInvalid: "aria-invalid",
2331
ariaKeyShortcuts: "aria-keyshortcuts",
2432
ariaLabel: "aria-label",
33+
ariaLabelledByElements: PROPERTY_ONLY,
2534
ariaLevel: "aria-level",
2635
ariaLive: "aria-live",
2736
ariaModal: "aria-modal",
2837
ariaMultiLine: "aria-multiline",
2938
ariaMultiSelectable: "aria-multiselectable",
3039
ariaOrientation: "aria-orientation",
40+
ariaOwnsElements: PROPERTY_ONLY,
3141
ariaPlaceholder: "aria-placeholder",
3242
ariaPosInSet: "aria-posinset",
3343
ariaPressed: "aria-pressed",
@@ -65,7 +75,11 @@ export const initAom = (
6575
set(value) {
6676
closureValue = value;
6777
if (ref.isConnected) {
68-
setAttribute(ref, attributeName, value);
78+
if (attributeName === PROPERTY_ONLY) {
79+
ref[key] = value;
80+
} else {
81+
setAttribute(ref, attributeName, value);
82+
}
6983
} else {
7084
upgradeMap.set(ref, internals);
7185
}

src/element-internals.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { CustomStateSet } from "./CustomStateSet.js";
3535
import { patchFormPrototype } from "./patch-form-prototype.js";
3636

3737
export class ElementInternals implements globalThis.ElementInternals {
38+
ariaActiveDescendantElement: Element;
3839
ariaAtomic: string;
3940
ariaAutoComplete: string;
4041
ariaBrailleLabel: string;
@@ -45,21 +46,28 @@ export class ElementInternals implements globalThis.ElementInternals {
4546
ariaColIndex: string;
4647
ariaColIndexText: string;
4748
ariaColSpan: string;
49+
ariaControlsElements: readonly Element[];
4850
ariaCurrent: string;
51+
ariaDescribedByElements: readonly Element[];
4952
ariaDescription: string;
53+
ariaDetailsElements: readonly Element[];
5054
ariaDisabled: string;
55+
ariaErrorMessageElements: readonly Element[];
5156
ariaExpanded: string;
57+
ariaFlowToElements: readonly Element[];
5258
ariaHasPopup: string;
5359
ariaHidden: string;
5460
ariaInvalid: string;
5561
ariaKeyShortcuts: string;
5662
ariaLabel: string;
63+
ariaLabelledByElements: readonly Element[];
5764
ariaLevel: string;
5865
ariaLive: string;
5966
ariaModal: string;
6067
ariaMultiLine: string;
6168
ariaMultiSelectable: string;
6269
ariaOrientation: string;
70+
ariaOwnsElements: readonly Element[];
6371
ariaPlaceholder: string;
6472
ariaPosInSet: string;
6573
ariaPressed: string;

0 commit comments

Comments
 (0)