antonfisher / react-simple-timefield

Simple React time input field
https://antonfisher.com/react-simple-timefield/
MIT License
97 stars 47 forks source link

Suggestion about input type #2

Open LouisCuvelier opened 6 years ago

LouisCuvelier commented 6 years ago

Hi,

Thanks a lot for your plugin. Amazing work ! 🥇 But, I noticed that you used "text" for your HTML input type. That's not user friendly for mobile users. Instead, what about to use "number" type by default ?

antonfisher commented 6 years ago

Hi Louis, Thank you for the feedback! This is a good point, let me test this, I'm not sure we can use : with a number type..

antonfisher commented 6 years ago

So far it doesn't look so easy. Selection methods I used aren't going to work with "number" fields: https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange

Note that accordingly to the WHATWG forms spec selectionStart, selectionEnd properties and setSelectionRange method apply only to inputs of types text, search, URL, tel and password.

The only way I see now is to use 3 separate fields for hours/minutes/seconds, need to check how it works.

milianriedel commented 2 years ago

@antonfisher hi, thx for this package. And what about inputMode="numeric"? https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode browser support is great