Live data from Hacker News

Why the Gov.uk Design System team changed the input type for numbers

technology.blog.gov.uk

41–50 of 177 posts

Re: Why the Gov.uk Design System team changed the input type for numbers

#41

Earlier quoted context omitted.

These recommendations are irrespective of server side sanitisation. Server side sanitisation doesn’t address any of the accessibility concerns. Server side sanitisation doesn’t address the silent dropping of characters concern. Server side sanitisation doesn’t address the incrementing/decrementing the value accidentally concern. That’s because the issues being discussed here are about creating a good UI that minimize…

Yeah, but in-/decrement and silent dropping would've been a non-issue with type=text. All I'm saying, they could've used text all this time, and never had all these problems to begin with, with the slight exception of a slightly-clunkier UI. Well, now they're text anyways, so, yeah. EDIT: If JS was an option, they could've also used text and then use " ".

Avoiding clunky UI is the raison d'être of gov.uk. You shouldn't have to deal with an awful user experience for things you are legally required to do to go about your life.

Re: Why the Gov.uk Design System team changed the input type for numbers

#43

This is off-topic, but I really like the current GOV.UK (several years old now). I don't really have opinions on the visual stuff, but I find it really pleasant to use. Filing my self-assessment tax return (only required because I run a side-business) is a fantastically straightforward experience. Step-by-step information entry, pre-filled with what they already know (e.g. main employer's salary), then they give you…

As a US guy, I've never looked at this site before. The extreme clarity of pages like https://www.gov.uk/vat-rates is really refreshing.

Indeed, that's a nice example. I felt the design could even improve public relations. If I were a UK citizen, I'd be relieved to find the information so well-designed and presented.

I've read here and there about the UK Government Digital Service, and have a very good impression. Reading a recent related article, it sounds like they have their priorities right!

https://gds.blog.gov.uk/2019/11/05/transforming-gov-uk-the-f...

Re: Why the Gov.uk Design System team changed the input type for numbers

#44
post #24

This 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

#45
post #4

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. Instead you must check input.checkValidity(), and perhaps use the CSS :invalid pseudo-selector to show the user that their entry is not valid. You cannot read the actual invalid value AFAIK on iOS (although you could simulate it by looking at key events, if you ignore selection and cut/paste).

Data entry with HTML is one area where you really want a native app, and you can get severely burnt trying to use a WebView. I have wasted months dealing with a variety of quirks over the years trying to make time entry friendly in HTML: all solutions have terrible compromises, and different browsers act quite differently (and can have nasty bugs).

Re: Why the Gov.uk Design System team changed the input type for numbers

#46
post #4

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…

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!

> a good interface will accept leading, trailing, or interior spaces

Won't pattern="[0-9]*" do the exact opposite of what you're suggesting?

Re: Why the Gov.uk Design System team changed the input type for numbers

#47

This is off-topic, but I really like the current GOV.UK (several years old now). I don't really have opinions on the visual stuff, but I find it really pleasant to use. Filing my self-assessment tax return (only required because I run a side-business) is a fantastically straightforward experience. Step-by-step information entry, pre-filled with what they already know (e.g. main employer's salary), then they give you…

Fantastically straight forward? I strongly disagree. I've done the SA many times, and trying to find out your balance or payments list or anything useful is now a kafka-esque nightmare. Last time I knew they must owe me money but they didn't say at the end, and it took me about 15 minutes to find out how much, with no indication of when it would arrive. At the end of the SA they even had some sort of message saying make sure you pay what you owe, which turned out to be nothing. This is all complicated because you pay on account, paying the next year's tax 15 months before you submit your return (they guess your next tax bill based on the previous one, as you don't submit the return for 9 months after the end of the tax year, so you don't get in too much credit).

The new SA process is no different from the old one, with minor cosmetic enhancements, but they've made it almost impossible to get to the old account sections.

Notice how there's no login button. On a website that relies on logging in. Now search for "self assessment login" or "self assessment account" or "self-assessment balance".

See any login button? See anything resembling a login? last year you could still get to the old account screen after some hunting, but that's gone now. The new account screen is a mass of text with links sprinkled through out, where the old one was a compact menu.

Plus, when you finally do find your accounts, you can only see one year at a time, have to use a drop down to change year, the amounts you owed are on one page, they amounts you paid are on another, some of these figures are still provisional, and nothing adds up.

As for submitting your company accounts, what a joke that used to be when they re-did it. I knew exactly what type of account I needed to submit. But to get to that form, I think they had a labyrinth of 16 web pages, each just one question per page, that you had to answer while they unhelpfully tried to pick the form you needed for you. Get the wrong form? No way to go back to see what answer you got wrong, no way to fix it, you just had to start again. It meant I had to go through it 3 or 4 times before I finally got the right form.

Before they "renovated" it, you just picked the form you needed.

They even did a whole blog post about how great the one page per question concept was, which turned out to be utterly bullshit.

I've lost all faith in the gov.uk team, I feel they're trying too hard to be cool and "innovative". They have thrown out convention, and are often making poor UIs and user journeys because of it.

Re: Why the Gov.uk Design System team changed the input type for numbers

#48
post #4

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…

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!

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 like vs what they look like now. Even newspaper websites like NYT are leaders with quality design.

It's easy to complain about those who still don't get it, but I feel like we've also made massive progress from the early wild-west days of the internet.

Still, I'm all for shaming those sites who still make inserting credit card numbers a pain in the ass.

Re: Why the Gov.uk Design System team changed the input type for numbers

#49
post #42

Quite strange that propriety systems like dragon are mentioned as motivation, surely they should fix the product or standardise.

I guess that, as a government, they are required to cater for people with accessibility issues (in this case: people who cannot type but need to dictate to enter text).

If you then cannot support the most popular dictating application, that’s not a good look.

Re: Why the Gov.uk Design System team changed the input type for numbers

#50
post #5

> However the inputmode attribute is now supported by all the mobile browsers we test in. This isn't extensive, which might be a tad misleading if you don't double check. They test on Chrome & Samsung for Android, and iOS is only the one engine. And those three browsers seem to be the only mobile browsers that have implemented it. (Well, Opera Mobile as well). [0] Desktop support is also extremely spotty. This seems…

Trying this out in the latest Desktop Firefox, the numberinput and pattern attributes seem to have no effect, and it behaved exactly like a regular type="text" input.
Post reply on HN