In summary the main issue is that, according to the spec, ` ` is only for numbers that are going to be parsed into a Javascript number. It has to make sense to increment, decrement or do other numerical operations on it. It's not to be used for strings or identifiers that just so happen to be numbers, e.g. credit card numbers. I'll admit this is slightly surprising to me but it does make a certain amount of sense. Th…
inputmode=”numeric” and inputmode=”decimal” have different quirks between Android and iOS. inputmode also acts differently on iPad and iPhone, and the keyboard shown varies from that for pattern=, and support for inputmode is missing from iOS11 (or iOS12?). Tread carefully! Note that type="number" is particularly horrible on iOS because it allows typing non-numeric values and then input.value just returns zero. Inste…
Why the Gov.uk Design System team changed the input type for numbers
101–110 of 177 posts
Re: Why the Gov.uk Design System team changed the input type for numbers
#102Earlier quoted context omitted.
I'm not against weird hacks where necessary, but how is this better than the GP's non-hacky suggestion? Inputmode isn't supported by most desktop browsers but it doesn't need to be. Every mobile browser save mobile Firefox supports it. ...I wonder what's up with Mobile Firefox?
Using the same markup for desktop and mobile means less code which usually translates to fewer bugs.
I apologize if you already know this, but to make sure we're on the same page: what "inputmode" does is tell phones to display the onscreen keyboard as a numpad, instead of a full set of QWERTY letters and numbers. Outside of a few edge-cases, you don't generally need that on desktop.
Re: Why the Gov.uk Design System team changed the input type for numbers
#103This is another reminder that floating point numbers are just a hack that should never be used by default. We have enough CPU, memory and bandwidth that we are able to transmit/store exact representation of numeric user input, and convert it to float only when necessary, as designed by programmer.
Indeed. Just like 32-bit integers, having fixed size floats as the default representation of numbers with a decimal component is a bad holdover from days of limited hardware. Let programmers use floats when they have the performance analysis to justify it. Before then, it's just another kind of premature optimisation - and high level languages should be avoiding it.
Re: Why the Gov.uk Design System team changed the input type for numbers
#104FYI, there's a few features available with the number input type that don't work with this method. Things like min, max and step attributes.
Re: Why the Gov.uk Design System team changed the input type for numbers
#105Earlier quoted context omitted.
That's one of the reasons I love Stripe's checkout being used everywhere and designers elsewhere basically copying them. The internet is constantly getting better and I don't think we give that progress we've made in web design over the last few decades enough credit. Just imagine how bad it used to be to just purchase a simple thing on an ecommerce site in the mid 2000s. Or remember what car websites used to look li…
> Or remember what car websites used to look like vs what they look like now. lingscars.com ?
Re: Why the Gov.uk Design System team changed the input type for numbers
#106Earlier quoted context omitted.
I think you're joking about Roman numerals, but millennials birth years are anything but easy to type in as a Roman numeral. For example, my birth year of 1987 is MCMLXXXVII.
Oh that's right, I meant post-millennials, who got a fresh start in MM.
Re: Why the Gov.uk Design System team changed the input type for numbers
#107In summary the main issue is that, according to the spec, ` ` is only for numbers that are going to be parsed into a Javascript number. It has to make sense to increment, decrement or do other numerical operations on it. It's not to be used for strings or identifiers that just so happen to be numbers, e.g. credit card numbers. I'll admit this is slightly surprising to me but it does make a certain amount of sense. Th…
That's a good rule of thumb there :) More pedantically, credit card numbers _aren't_ numbers in the first place. They are identifiers that happen to use numerical digits. Same as phone numbers. Treating them as numbers at any point in a system is an error. My dream is this detail of the HTML spec forces people to rethink their schema design while they're at it.
Re: Why the Gov.uk Design System team changed the input type for numbers
#108In summary the main issue is that, according to the spec, ` ` is only for numbers that are going to be parsed into a Javascript number. It has to make sense to increment, decrement or do other numerical operations on it. It's not to be used for strings or identifiers that just so happen to be numbers, e.g. credit card numbers. I'll admit this is slightly surprising to me but it does make a certain amount of sense. Th…
One good reason for this is that for things like credit card numbers, a good interface will accept leading, trailing, or interior spaces. Sites that make me type in values in exactly their own weird format are an abomination. Site A: Ah ah ah! You put a slash in your date! No soup for you! Site B: Ah ah ah! You didn't put a slash in your date! No soup for you!
Don't make hundreds to millions of users do extra work that could've been automated with a little more care.
Re: Why the Gov.uk Design System team changed the input type for numbers
#109Similarly, here is your reminder than US Zip Codes aren't numbers, because many of us here in the Northeast have them start with a zero (or even two). So don't store them as integers, because Boston is 02108, not 2108. See https://en.wikipedia.org/wiki/List_of_ZIP_Code_prefixes
My general rule is if you can't add two values together then they shouldn't be represented as number types.