-
Notifications
You must be signed in to change notification settings - Fork 201
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
Split Input Date and Datalist broken on Android native browser #383
Comments
Wow, nice!!! I haven't looked into all your research, but will do this. It's great, thank you. About your Android research regarding that Andorid seems to support input widgets. You are partially right here and what webshims is doing with Andorid is: If Andorid is detected and this browser does not support progress element and fieldset disabled, webshims assumes, that input widgets are not implemented right, even if Modernizr is reporting, that this input is implemented (see also here: Modernizr/Modernizr#769). The reason for this is quite simple: I also made a lot of tests with a lot of Android versions and the result is heavy to got this 100% right. Some versions got it right and some had some problems. Additionally not only the version but also the manufacturer of the smarthpone had influence. The problems were: 1. Datepicker does not offer a clear button/UI, 2. datepicker enters the value in wrong format (some do not add leading zeros, some other use format of OS configuration instead of yyyy-mm-dd), 3. some version do neither trigger blur nor change (Note: I implement missing change event in iOS and others, if at least blur is working) and 4. on older versions not even a datepicker is shown. This said, while webshims way to handle this is indeed not very "distinctive"/"precise", it is a) fail proof and b) future orientated, if a future version of andorid has those named features (progress element and fieldset[disabled] it will also only use the Modernizr tests. And I think I'm right here, because beginning form Andorid 4.4 the input widgets shouldn't be replaced on Andorid anymore by webshims. With other words: Although webshims could be work more granular with older Android versions, you should not remove it, I had my reasons for this! About your two concrete issues:
|
Thanks for the quick response, I think you are definitely right about the Android browser just behaving terribly in this case.
As a side question, you may have noticed I also tested a type of input I call a Numeric Code. Such as a number only postcode, PIN or Credit Card number. For this type of input it makes sense to use text fields on desktops where the maxlength and pattern validation come into play and number fields on touch devices where you get the numeric keypad. The number field implementation of webshim is not helpful here because none of the features like grouping or stepper are needed and the maxlength is not carried through.
|
As already said datalist will be fixed soon. Additionally native datalist is comming for Android. ;-). About postcode, pincode and credit card number, those kind of inputs are "numeric" or "digits", but not type="number". The right markup for this would be:
This should work with iOS and Firefox for Android. Chrome is working to get this feature soon into Chrome for Android. You should not turn it into type="number", because some browsers will remove leading zeros and other stupid things. As a workaround you could detect, wether inputmode is supported and if not replace it with type "tel", it's also semantically wrong, but won't have so much side effects. This said I will also add a new class called |
Ok, I wanted to look into your datalist issue and tryed the following demo page with Anrdoid 4.3. And it worked pretty good. So I can't reproduce your issue. Can you test or help with some more information? |
@davidelrizzo But before releasing, I also want to look into your datalist issue. As you see above, I can't really reproduce it. Can you help here? Additionally, from your spreadsheets I see, that you mention type number validation does not work in IE8. For me this is working. Can you help me here, too??? |
Oh, you are right the datalist on your configuration page does work on my 4.3 Android browser. I will have to do some more testing when I am back at work on Monday, but most likely my sample page was not correct somehow. As for the IE8 validation, the reason I did not bring it up is that I had a feeling it was a local issue. I had someone else test it on like 2 levels of citrix login so I have a strong suspicion something wasn't right there. I will check this again too and let you know. I am keen to keep that UX analysis spreadsheet up to date and will likely add the time and month input too. Thanks once again for all your help and work. Webshim is seriously one of the best tools for anyone building online forms period. |
Ok, this was enough information for me :-D. Just fixed it. |
@aFarkas I had a careful look into the issues we discussed.
I also had a look into the So that concludes this round of my analysis. Websims is (one way or another) solving all my problems and I will begin to implement it into our projects. Thanks again. |
I just added some small inputmode="numeric" support for mobile browsers: http://jsfiddle.net/trixta/7NEBb/. Note: This only works with the newst "unstable" version of webshim! |
@aFarkas polyfilling Keypads vary wildly!
So this raises some difficult questions around
I dont think we can make absolute assumptions about the exact nature of a Numeric Code. A PIN number should only have numeric values, a Credit Card might be nicer to separate groups with spaces and hyphens, a Serial number may have brackets or who knows what else. As inputs it is definitely best practice to allow users to enter values in the way they feel comfortable. Given the input is My Proposal
|
Hi, I made same observation, but my conclusion is a little bit different here. To sumarize it: inputmode="numeric" should give us the following charckters: +-.,0123456789 Which means a switch between inputmode="numeric" to type="tel" is obtrusive. My current approach is therefore to always look for both: pattern="[0-9]+" and inputmode="numeric" (The first pattern already works on iOS...). Maybe I will improve this to detect things like [0-9]{3,9} and so on and do the fix also on iOS. You are right, that sometimes an inputmode="numeric" to type="number" would be better or sometimes also an inputmode="numeric" to type="tel" without an explicit pattern is appreciated by a developer, but those kind of switches are obtrusive and need to be guarded by an option or a specific class/attribute on the element. -> The developer has to explictly opt-in for this + I have to document it somewhere/somehow. Any suggestions? Maybe: <input inputmode="numeric" data-wsmode="tel" />
<input inputmode="numeric" data-wsmode="number" /> About native support. There is a way to detect it and I'm using this detection already. Interestingly inputMode is already supported on Chrome Desktop. Don't understand why :-D. And on Firefox it is hidden behind a flag: "dom.forms.inputmode" + something different/similiar "dom.mozInputMethod.enabled" |
Seems messy to me, if you want to add another attribute like Looking at the spec for inputmode it says that the intent of this property is to specify what type of input mechinism would be most usefull, ie. which keypad to use without effecting the The only odd behavior then is the iOS pattern numeric keypad, which is Apple's attempt to implement |
Ok, you are right about this being messy, but I will never ever do a switch to My current work on this, can be seen here: http://fiddle.jshell.net/trixta/7NEBb/show/ The first example simply shows, why I won't use the type="number" it's simply to obrtusive. All other examples show how I think this is the best way to do this automatic. As already said, in some situations, there might be a better different approach, but those approaches are obtrusive and needs to be hidden behind a configuration. If you want such a configuration please open a new ticket. |
Fair enough. I think you solution is practical while being as safe from assumptions about the intended input as possible. This seems to fit with your Webshim philosophy of polyfilling without harm. |
Wow, thanks. Kind words. |
I have done a fairly comprehensive UX analysis of how the HTML5 Number Date and Datalist inputs behave for real world inputs across common browsers natively and with a webshim fallback. The only major issues I can see are with Android 4.3 buggy support (tested on a Galaxy S3).
"splitInput": true
enables auto tabbing between the three fields. This is buggy and almost unusable on the Android browser. (incidentally this also happens with other common JS input plugins such as jQuery Autotab and the Masked Input Plugin).I do not understand why Android is getting polyfilled at all. It does have decent support for Number and Date inputs but webshim replaces them anyway (Chrome Mobile and iOS use the native HTML5 version as expected).
My only solution to this problem is to detect Android browsers with JS and not run webshim for it at all. However this leaves me completely stuck without Datalist support.
The text was updated successfully, but these errors were encountered: