katemihalikova / ion-datetime-picker

Date and/or time picker for awesome Ionic framework
MIT License
168 stars 101 forks source link

Use input tel type instead of text #3

Open yehuda54 opened 8 years ago

yehuda54 commented 8 years ago

I am using the time portion of the plugin and it is great. An enhancement, for the time dialog is to use input type=tel, instead of input type=text. This way, when a user taps into the box (tested on android), only the number pad appears (not the letters)

See ionic doc: http://ionicframework.com/html5-input-types/#tel

Thanks

katemihalikova commented 8 years ago

Thanks for your idea. Input types should be used semantically. Time should be number formatted in particular way, including leading zero, so type="number" can't be used. On the other hand, type="tel" should be used on phone number input only. For showing appropriate keyboard, pattern attribute can be used, but this feature is currently almost nowhere implemented. Please file a bug report against your favourite mobile operating system to have them implement this feature. In the future, type="text" pattern=... should be the standard way to have mobile phones pick the best keyboard.

For now, I can imagine a switch in config to set the input's type to either text or tel depending on developer's preferences. As this plugin is used in desktop browsers as well, tel should not be the only option.

Simpler1 commented 8 years ago

Hi Kate,

I agree with your long term solution of using pattern, but prior to the OS implementing this, it seems that type="tel"would be a better default value. Since the user will only be entering numbers for time fields, the number key pad seems like the best short term solution.

Can't the leading zero be added programmatically after the user moves focus to another field?

BTW, great work.

Thanks

katemihalikova commented 8 years ago

Hi, I think that type="tel" can be added as an optional feature (or vice versa) to provide both the semantic and the best-usability ways.