Skip to content

Commit cb38778

Browse files
calebebyeps1lon
andauthored
fix: input[type="number"] maps to [role="spinbutton"] (#796)
Co-authored-by: Sebastian Silbermann <[email protected]>
1 parent 2a2f7f4 commit cb38778

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

.changeset/small-chairs-fly.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"dom-accessibility-api": patch
3+
---
4+
5+
`<input type="number" />` now maps to `role` `spinbutton` (was `textbox` before).

sources/__tests__/getRole.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ const cases = [
101101
["input type=hidden", null, createElementFactory("input", {type: "hidden"})],
102102
["input type=image", "button", createElementFactory("input", {type: "image"})],
103103
["input type=month", null, createElementFactory("input", {type: "month"})],
104+
["input type=number", "spinbutton", createElementFactory("input", {type: "number"})],
104105
["input type=radio", "radio", createElementFactory("input", {type: "radio"})],
105106
["input type=range", "slider", createElementFactory("input", {type: "range"})],
106107
["input type=reset", "button", createElementFactory("input", {type: "reset"})],

sources/getRole.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ function getImplicitRole(element: Element): string | null {
176176
return "combobox";
177177
}
178178
return "searchbox";
179+
case "number":
180+
return "spinbutton";
179181
default:
180182
return null;
181183
}

0 commit comments

Comments
 (0)