-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Open
Milestone
Description
Which @angular/* package(s) are relevant/related to the feature request?
No response
Description
Currently when your formField data is a number the input must be of type number.
Consider this form:
readonly data = signal({ age: 4})
readonly f = form(this.data)
And this form
<input type="number" [formField]="f.age">
<input type="number" [formField]="f.age" pattern="[0-9]*">
<input type="text" [formField]="f.age" inputmode="number" pattern="[0-9]*" >This gives several problems.
- For one patterns are not allowed. This is according the W3C spec, but some mobile systems (IOS) allow to show the numeric keyboard when you put the pattern="[0-9]*" on a number input.
- For real good accessibility/mobile support
<input type="text" inputmode="number">is preferred, but because the
type is text, it is not allowed. The problems that are solved by this kind of input are explained very well on this site: https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/
Proposed solution
Allow <input type="text inputmode="number"> for form fields of the numerical type and support the pattern="[0-9]*"
Alternatives considered
Creating a custom control, and I think this is currently the only workable solution.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Type
Projects
Status
No status