Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for type 'number' #312

Open
RavenousPett opened this issue May 9, 2019 · 10 comments
Open

Add support for type 'number' #312

RavenousPett opened this issue May 9, 2019 · 10 comments

Comments

@RavenousPett
Copy link

I.e. so the input type = 'number'

Allowing the number keyboard to show on mobile:

IMG_5360

@SamKirkland
Copy link

I would also like this!

However word of caution setting type="number" might cause a lot of problems.
See: http://bradfrost.com/blog/post/you-probably-dont-need-input-typenumber/

Setting inputmode for modern browser and falling back to the pattern attribute would show a number keyboard on mobile devices without the usability issues of type="number"

@aneurycasado
Copy link

Is there any progress on supporting type="number?

@redblue9771
Copy link

type='tel'

Seems to have such side effects.

@brianpmaher
Copy link

@redblue9771 type='tel' does not include a decimal on the keyboard on iOS Safari.

s-yadav added a commit that referenced this issue Feb 20, 2020
- Fix type declaration. Added allowLeadingZeros on types. #385
- Fixed #386. Clear the input on blur if ony `-` is added.
- Added prop-type defination for RefObject #384
- Added inputMode = numeric by default so in mobile browser proper keyboard should open. #189, #312
s-yadav added a commit that referenced this issue Feb 20, 2020
- Fix type declaration. Added allowLeadingZeros on types. #385
- Fixed #386. Clear the input on blur if ony `-` is added.
- Added prop-type defination for RefObject #384
- Added inputMode = numeric by default so in mobile browser proper keyboard should open. #189, #312
@UncaughtTypeError
Copy link

This is essential for an input formatting library.
If input number types are supported so are their attributes, min and max being especially useful in the case where the library doesn't provide these forms of validation as a feature.
Rejection of non-numeric numbers are built-in as well, browsers may also provide stepper arrows for incremental inputs.

@halcwb
Copy link

halcwb commented Jul 5, 2020

Another problem with the number type I stumbled upon is the behavior in FF. When the type is number, you can type in non numeric characters, but then just about nothing happens. So, you get ugly things like:

FF number problem

@R4VANG3R
Copy link

To get a different keyboard without changing the type you can use the inputMode attribute https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode

@Grawl
Copy link

Grawl commented Jun 15, 2021

@R4VANG3R there is no [inputmode] that works like type='number' keyboard on iOS https://codepen.io/Grawl/pen/RwpEKzQ

decimal have , button but I want . button

@fulcrumlabsio
Copy link

UncaughtTypeError

This please! If type="number" is not supported. Is there a workaround to be able to use the text field with min/max validations? 🤔 I'm using this field in a form and only want to allow values greater than 0. The isAllowed prop is not robust enough and seems to be causing issues.

@vilbergs
Copy link

vilbergs commented Sep 14, 2023

UncaughtTypeError

This please! If type="number" is not supported. Is there a workaround to be able to use the text field with min/max validations? 🤔 I'm using this field in a form and only want to allow values greater than 0. The isAllowed prop is not robust enough and seems to be causing issues.

Could you elaborate on the issues you experienced with isAllowed?

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

No branches or pull requests