Skip to content

fix(types): allow list attribute on all valid input types - #5331

Merged
JoviDeCroock merged 1 commit into
preactjs:mainfrom
playlikeboy:fix/input-list-attribute-types-5330
Oct 25, 2026
Merged

JoviDeCroock merged 1 commit into
preactjs:mainfrom
playlikeboy:fix/input-list-attribute-types-5330

Conversation

@playlikeboy

Copy link
Copy Markdown
Contributor

Fixes #5330

Summary

Per HTML Living Standard §4.10.5.1.13 and MDN, the list attribute is valid on:
text, search, url, tel, email, date, month, week, time, datetime-local, number, range, and color.

Previously, InputAriaRoles only declared list on text | search | tel | url | email, omitting it on range, number, color, date, datetime-local, month, time, and week. In particular, this prevented <input type="range" list="..." /> (the standard way to get tick marks on range sliders) and <input type="number" list="..." /> from passing typecheck.

Changes

  • Updated InputAriaRoles in src/dom.d.ts so list?: Signalish<string | undefined> is valid on range, number, color, date, datetime-local, month, time, and week.
  • Preserved strict ARIA role constraints (slider for range, spinbutton for number, and no role on date/color/time/week).
  • Added comprehensive regression tests in test/ts/dom-attributes.test-d.tsx covering all newly allowed input types, as well as negative tests ensuring list remains disallowed on invalid types (button, checkbox, file, hidden, image, password, radio, reset, submit).

)

Signed-off-by: Shaswat Raj <shaswat340@gmail.com>
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 99.856%. remained the same — playlikeboy:fix/input-list-attribute-types-5330 into preactjs:main

@JoviDeCroock
JoviDeCroock merged commit 1c0f1f8 into preactjs:main Oct 25, 2026
5 checks passed
@JoviDeCroock JoviDeCroock mentioned this pull request Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The list attribute is missing from many input element types

3 participants