
I Wanted to Type a Number (2016) - bpierre
https://www.filamentgroup.com/lab/type-number.html
======
floatingatoll
This advice is incorrect to recommend using type="number". On a desktop,
trackpad and mousewheel scrolling while the pointer is hovering over and/or
focus is within a type="number" field will alter the number within it,
resulting in undetected data errors as digits off-by-one without user
awareness.

~~~
PetahNZ
Not sure if its just me, but I tried it and the mouse wheel does not cause the
numbers to change, either focused or not. (latest chrome on mac)

~~~
mbel
Firefox on Windows does this when control is in focus and the mouse cursor is
over the control.

------
amelius
Since many websites already implement their own input fields, I see one
solution: implement the entire keyboard in JavaScript

/s

~~~
learnstats2
The default keyboards are inflexible for so many reasonable use cases that I
would actually consider this unironically.

~~~
egoisticalgoat
What use case is there for (able-bodied) people where a websites own
implementation of an on-screen keyboard would improve anything?

~~~
classic959
I think this may have been the result of banking malware (e.g. Zeus back in
the day) which was hooking OS calls to capture keyboard input and steal
passwords. I'm not sure whether the on-screen keyboards would be vulnerable in
other ways though.

------
tracker1
The worst is a "PIN" input that is only numbers, and the numbers on the
keyboard are behind a modifier key, that you have to hit for every, single,
number. Not including negative, separator and decimal characters on number
input is worse.

~~~
ktpsns
Well, on most "virtual" mobile phone keyboards you can long-press the modifier
key in the same way as CAPS LOCK and friends worked on our old mechanical
keyboards.

Nevertheless, virtual keyboards need to be improved, and in my opinion it's
not the websites faults. It's the browser who has to do its job.

~~~
giancarlostoro
On LG phones they add the numbers to the top of the querty keys. On Android
you can install alternative keyboards.

~~~
bitwize
Hacker's Keyboard is a good choice for Android phones.

~~~
tracker1
I've used it, it's not a very good experience for conversation... I mostly use
gboard, because of gesture input. I'm in several conversations and/or emails a
day, I only have to input a numeric pin like described maybe once a month.
Doesn't mean it shouldn't be improved on.

------
kohtatsu
How about a new attribute to match what phones actually provide:
keyboard=text|digits|url|emoji

~~~
ThePadawan
I have been thinking about a similar question while building a image hosting
site.

Which resolution of thumbnail should I provide for each client?

On a desktop, I can be reasonably sure that the user doesn't have limited data
or bandwidth, but their resolution (and dpi) might be quite small.

On mobile, the user might have a hiDPI screen which indicates I should send
them a high-resolution thumbnail. But I don't know if they would like me
spending their limited data or bandwidth that liberally.

So far, I haven't found a way to indicate or request these sort of
preferences, but with the up-and-coming support for srcSet, <picture> elements
etc., I would love to provide multiple thumbnail alternatives if a client
could reasonably decide between them.

~~~
pjmlp
A possible solution, but it requires JavaScript enabled, and manual work, is
to have a service worker provide such information up to the server.

------
ktpsns
That's a very detailed study.

As a user, I whish there was an easy way to just change the keyboard to what I
want to input. Android/Google keyboard seems to have something like that
nowadays (deeply hidden, however), i.e. the possibility to switch to a numeric
keyboard, as a user.

~~~
grawprog
Have you tried AnySoftKeyboard on android? It's open source and fully
customizable with different layouts and allows you to switch between different
entry methods with a swipe or button press.

I've got a QWERTY layout, both regular and one with extra keys for terminals,
a full number layout and a keypad layout all easily switchable. It also has
what's surprisingly become one of my favourite features, left and right arrows
at the top. It helps so much with text navigation, especially when writing
long blocks of text.

~~~
SAI_Peregrinus
I was going to recommend that. It's a very nice program, and also happens to
be open source.

------
mars4rp
We were dealing with this today! so we want to use type="number" but it
doesn't work!

first, the browser default error message is not accessible.

then we decided to use novalidate="novalidate" to tell browser to not do the
validation.

Chrome does not submit the value if the input is not perfect numeric ( try
"......"). so it does wipe out user input without letting us catch it on the
server!

We just changed it back to type="text" !:(

------
Brendinooo
ZIP code should be a number pad for every American, but if someone ships or
bills to Canada then you have to have the letters. Not much you can do about
that, unfortunately.

~~~
news_to_me

        if (country === countries.US) {
            input.setAttribute('inputmode', 'numeric');
        }

~~~
SAI_Peregrinus
That doesn't work.

For example, The Hartford Fire Insurance company's address is

    
    
        HARTFORD FIRE INS CO
        1 HARTFORD PLZ
        HARTFORD CT 06115-1703
    

Note the zip. Leading zero, and the last 4 digits. There are other businesses
at the same address, with different zip codes. EG

    
    
        HARTFORD FINANCIAL SERVICES
        1 HARTFORD PLZ
        HARTFORD CT 06115-1709
    

Etc, etc. Zip codes in the US are text strings, that happen to be composed of
the digits 0-9 and a hyphen.

------
Aardwolf
Gee, it would have been better if all this was is a suggestion for which
keyboard layout to show initially

------
laktak
Please add (2016) to the title.

