Skip to content

Commit f8af9df

Browse files
author
Vladyslav Zuiev
committed
Change Number input type to text instead of number
There are multiple problems when it comes to number input e.g. there is empty input ref value when inputted value is not a number. So, in the context you will have null but on UI you'll still see value with overlaying label. For more limitations you can read following article. https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/
1 parent fd2ca41 commit f8af9df

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ cypress/screenshots
2323
!.yarn/releases
2424
!.yarn/sdks
2525
!.yarn/versions
26+
.history

packages/ra-ui-materialui/src/input/NumberInput.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ export const NumberInput = ({
137137
onFocus={handleFocus}
138138
onBlur={handleBlur}
139139
className={clsx('ra-input', `ra-input-${source}`, className)}
140-
type="number"
140+
type="text"
141+
inputmode="numeric"
142+
pattern="[0-9]*"
141143
size="small"
142144
variant={variant}
143145
error={(isTouched || isSubmitted) && invalid}

0 commit comments

Comments
 (0)