Skip to content
This repository has been archived by the owner on Sep 20, 2018. It is now read-only.

input type is text #5

Closed
jamiegiftbit opened this issue Oct 31, 2016 · 2 comments
Closed

input type is text #5

jamiegiftbit opened this issue Oct 31, 2016 · 2 comments

Comments

@jamiegiftbit
Copy link

This looks very promising and I'm happy to have found it. I completely agree a user expects an input type of number, however when I have tried this, and inspected it, it shows it as being of type="text". I see this how it's set in NumberInput.js as well.

I also tried your demo from my phone, where I'd expect the input to bring up a number pad and it does not. Perhaps I've done something wrong. Please let me know if I'm missing something here.

Thanks and regards

@NoHomey
Copy link
Owner

NoHomey commented Nov 1, 2016

You are not missing anything. The type is "text" on purpose since the HTML5 apis for validation are not flexible enough to allow detecting exactly the reason for invalid input (<input type="number" /> just uses a regex to test the whole value and once this value dose not match it sets the input to invalid state). And as well when the input becomes invalid it's value prop becomes empty string which breaks the UX since the user sees an error message but the input's value is already an empty string which forced me to create material-ui-number-input in first place ...

The idea of the project is to allow the developer to decide the behavior of the input whether ii's possible for the user to enter invalid symbols and get an error message or get a warning message and auto corrected value or just force valid numbers to be entered without displaying any message at all while the developer can really get a valid number once the input is really a valid number. This behavior can be changed in the demo by selecting a strategy. As well the behavior can be further changed based on the value of min and max props as well is the input required or not.

Lucky for you if you decide to use my project and you want your users to get number pad on focus there is the HTML5 property inputmode which is as well supported by React. I've also added support for it in NumberInputProps and NumberInput.PropTypes whit the 5.0.16 release. So setting it to "numeric" should open a number pad.

I' ll add the display number pad option as well option to display meaningful messages and option to handle only "critical" errors later today.

@NoHomey
Copy link
Owner

NoHomey commented Nov 1, 2016

@jamiegiftbit I've added the inputMode to the live demo but it dose not work for mine Android tablet can you check on your phone?

@NoHomey NoHomey closed this as completed Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants