Why the Gov.uk Design System team changed the input type for numbers (2020)
technology.blog.gov.uk
technology.blog.gov.uk
There is a reason that the number printed on the credit card is grouped into 4 digits, and I believe that it makes human parsing easier. When I submit the form and it says "invalid card number", trying to figure out which digit I mistyped into the form while scanning that long string of digits with my eyes, gazing at the card and back at the screen is just stupid.
Naturally, you cannot reliably paste into any of them.
But then, my bank has disabled copying everywhere sort codes are displayed anyway!
UX galore yet I feel we've gone backwards. The damn thing has so much padding it doesn't even fit on my full-HD monitor. Except it should, but they capped the height and made it so I have to scroll. I just don't have the words, I'll let you guys decide further from that image.
Excel will store the data as a number, and display it with the selected format, but you can't type it in with the spaces etc. - it needs to be input as just a number.
I think this way of doing things is quite common.
Type "LS29JT" and get an error because it does not like that you did not add the space "LS2 9JT"
Or even, type "LS2 9JT" and get an error because it does not like that you did add the space.
I'm not sure why. The Inward code is always Number-Letter-Letter. The outward code can be variable length and format. The space is certainly beneficial for visually parsing, but why W11AA isn't valid when W1 1AA is valid is confusing.
Letters received need only have the W1 part read, to see where they should be sent.
When they reach Westminster, the 1AA part is read to sort them for final delivery.
Sometimes you can feel that the code has been written by an engineer who is following the 'spec' to the letter instead of thinking of UX.
W111AA
One letter at a time, auto-inserting the space
W / W1 / W11 / W11 1 / W11 1A / W11 1AA
But for W1, you'd do
W / W1 / W11 / W1 1A / W1 1AA
Which would be jarring - you don't know when the inward code ends without typing a space, so you have to infer.
That said there's no reason not to allow [a-zA-Z0-9 ] and format after typing is finished (onBlur or even after submission).
(Poorly implemented address validation in the UK was behind the change in BFPO addresses 10 years ago -- https://fetchify.com/latest-news/lets-talk-about-bfpo-addres...)
Let the user type in the postcode and when they submit you can parse it as a whole maybe just in the backend, insert the space and display with the space from then on. Simple.
https://stackoverflow.com/questions/164979/regex-for-matchin...
These are almost universally displayed as two groups of three digits, that's seven characters, count them... separated by a hyphen and almost universally have to be entered in to a six character field, non-numeric characters not accepted.
Definitely one or my favourite minor annoyances.
However, if you paste a number with commas in it, it will display correctly, but on the next screen you will discover it is transferring a different amount, as if it parsed the number up to the first comma.
(As an aside, this is one of the underrated things about best-practice React: that kind of bug can never ever happen. What is displayed is fixed by the rendering of the data model, never the other way around.)
Even though they got the email.
Incidentally: how do your customers know how you entered their email address? That's a matter that is at the discretion of the mailserver software; it can be automatically rewritten.
What you typed into your mailer isn't guaranteed to be reflected in any of the headers the recipient sees. Far from it.
We want a user to just be able to input numbers and not letters. Yes, that is a string, but from a user experience perspective we are going to ask them to input numbers / sets of numbers.
This is important, because if they just make it a regular text field then mobile phones will show the full keyboard which makes inputting long numbers very difficult.
Anything that can have and needs to retain leading zeros is a string. That string can be restricted to 0-9 and would benefit from the numeric keypad.
https://stackoverflow.com/questions/6178556/phone-numeric-ke...
Yes, that’s the whole point of the original article - that up until now browser support was insufficient to roll this out on a government website.
I’m aware of what happens if you save a string of numerics into an integer. It’s still entering a number from a user / ux perspective.
(e.g. a CC number input and stored as "1" and displayed as "0000 0000 0000 0001" - an extreme example I know)
In practice, the Wikipedia list of issuer prefixes doesn't show anyone using leading zeroes, so as long as you don't use separate inputs for each number cluster this specific issue probably won't bite you, though others might. IMO it's better to preserve verbatim user input than to capture malformed data and fix it after the fact.
Graphically I was thinking of the opposite of hiding the number, but rather making it clear to see by automatic digit grouping and stuff.
I would bet this sort of pragmatic workaround is taking place.
We see this with IP addresses where hardcoded assumptions that were wrong or became wrong blow things up. For example, many people didn't realize that 172.* isn't entirely reserved for internal IPs.
IBAN fields should NEVER be length-constrained. Every country uses different lengths, and if you have a max length, chances are you are locking out some users from other countries (which actually is in violation of European law [Article 9, Regulation No 260/2012]).
If it auto-formats that may be fine, although lots of these have very culturally dependent formattings (phone numbers are a prime example here) so freeform formatting is definitely better.
It’s also important to realise that lots of things which are numerical (sequences of digits) are not semantically numbers e.g. leading zeroes are relevant in a phone number or CC number, and incrementing or decrementing either is nonsensical.
(There are exceptions, of course, A6000 would be read as "ay six thousand").
Presumably this is USA-ism noone bothered to fix.
Siri: "Now playing one thousand and ten wins."
Or even worse, when I ask her to play the radio station 2GB in Sydney, known as "two gee bee, eight seven three."
Siri: "Now playing two gigabytes eight hundred and seventy three."
But I wonder if that's because I'm from a part of England where the first digit is large (>4). I can see A1066 is more likely to be "ay ten sixty-six".
"Four forty" is a better way to say it than "Four hundred forty" because the hundreds place is used to denote branches off the main interstate. I440 should attach to I40 in at least two places based on its number. And checking it on a map, it does look like I440 is a beltway through Raleigh.
Also, I can see an I540, which means a spur off of I40 that. And you can see that I540 connects to I40 in one spot and deposits you near I87.
true 'mericans don't even know how to pronounce-out numbers that bigly
here in california there is this delightful local custom to give the freeway some random place name that changes every two miles, but give all the signs a number. or vice versa.
so it sounds like: "turn north on the rancho-el-coronado-pacifico-jackson expressway" which means turn "physically east on the 610" because it's actually north-south, but run's east-west "logically".
then for extra fun, add state highway numbers that overlap the us freeway numbers and use lots of proper nouns. as in "a crash occurred at the interchange of the northbound 415 and the 188 at the south 67 jason plotz memorial parkway on the escobar-de-los-muertos exit headed eastbound". i don't even know what i just said, but at least twenty commuters reading this just rerouted to avoid this mess.
Numerals are symbolic representations using digits, but may or may not have numeric properties.
The instructions tell me to enter the account code "exactly" as on the paper.
Except for the fact that it starts with <letter><dash>. I'm supposed to omit that part...
As a webdev I just really want to submit a PR.
If you can sanitize, then it doesn't matter what the user input was.
If validation fails, notify the user.
even worse with IBAN numbers
Another gripe is when it requires me to tell it what kind of card it is, when it also then validates the BIIN, and tells me I'm wrong if I forget to chose - why not just fix it for me?
IMO this is the gold standard for government websites
And it only got worse during the pandemic when the Gov purposefully tried to conflate their word with the law, using gov.uk to do so.
Tax Free Childcare is a scheme that allows you to pay for daycare and get a 20% discount applied via the government.
It works quite well, but I'm convinced there is a deliberate attempt to frustrate people and stop them using it to save money.
For example, you cannot bookmark the sign-in page, you have to search for it from the gov.uk homepage each time and go through several intro pages. And then you have username + password + 2FA + 3 security questions.
And you have to login every 3 months to re-declare your eligibility.
The UK's Driver and Vehicle Licensing Agency takes this to an extreme by not offering online versions of some key services, such as re-applying for a driving license after a medical suspension. If your re-application involves a fee, you have to send them a (paper) cheque or postal order. I do understand that a postal order is a valid form of payment, even in the year 2022 (it can be used by people without a bank account), but not to offer credit card payment or bank transfer is amazing.
[Edit] I didn't own a car, I'm against private vehicles on the whole, and especially ICE private cars. I wanted to be able to hire a car occasionally. And a driving licence can be a requirement for certain jobs, even if they aren't "driving" jobs. A driving licence is the standard ID here; if you have neither a passport nor a DL, you will have to jump through hoops to prove your ID. So I'm angry that the DVLA can administratively deprive you of rights for ten years, without the matter ever coming before the judiciary.
It's quite well hidden but the link to sign straight in is here:
https://www.gov.uk/sign-in-childcare-account
You are absolutely on the mark regarding this service though. It's bananas.
UK government websites used to be AWFUL. Navigation and signposting is still awful; but UX has improved a lot in the last two years. And their approach to cross-device UX isn't bad (it's impossible to be "good" with mobile devices, IMO). But ten years ago, my sense was that government websites really didn't want people to interact with the government electronically at all. You had to use Internet Explorer; you had to authenticate, which meant getting an ID, which required physical documents, so a postal interaction.
It's much better now, but that doesn't mean it's good.
These numbers were amounts, i.e. actual numbers, and not text fields with only digits, so `type="number"` doesn't even work for actual numbers, as soon as you move beyond English.
I wish more sites used appropriate inputmodes - it is often a pain in the backside to enter numeric information on mobile.
Lo and behold!
Probably going to use this at work today :)
AFAIK there isn't a lowest bid system anymore, so why is everything so difficult?
Just imagine being able to worry because some stuff doesn't work with screenreaders...
It is in use across a huge number of Australian government websites - the Australian Cyber Security Centre, Services Australia, Department of Health, Department of Veterans' Affairs to name just a few.
The agency that owned it had a huge amount of funding cut from its budget, and now it's being supported by an (admirable!) open source effort: https://designsystemau.org/
It's wonderful that there is this level of community support, but so disappointing that the government couldn't recognise the importance and usefulness of continued funding.
Much like everything else that came out of that agency, it was released and then promptly abandoned.
The goal at various points was something gov.uk-like, but I think we failed pretty miserably on all counts.
https://design-system.service.gov.uk/
It's even published under this liberal license:
https://www.nationalarchives.gov.uk/doc/open-government-lice...
Luckily some other level of government made another interface for the same system cos they got tired of it.
They managed to build an in-house, central resource (GDS/Government Digital Service) and pioneered a lot of public service design practices which are the template for USDS and others.
However, my understanding is that the GDS team is greatly diminished these days and the consultants are back across separate government departments again.
That just seems to be the natural cycle of life. Some (somewhat independent) part of the government does something good and admirable, all of the self-interested politicians and other functionaries see that success and want to have a part of it, insert themselves and their interests into the thing, and in the process end up ruining it because they had no idea what they were talking about and should instead have left that work to the domain-experts which managed to make it successful in the first place.
But the french administration has been very heavily centralised since forever, which probably makes that kind of project easier to run.
When to use and to not use it is slightly vaguely explained here: https://gouvfr.atlassian.net/wiki/spaces/DB/pages/606012403/.... If I understand correctly, it's supposed to become mandatory at some unknown point in the future for all websites operated by the state. Whether some or all of it could be used by other entities and under what conditions is not exactly clear to me.
> Il est formellement interdit à tout autre acteur public d’utiliser le système de design de l’État (les administrations territoriales ou tout autre acteur privé). Le système de design de l’État représente l’identité numérique de l’État. Par conséquent, ces entités ne sont pas concernées par son déploiement ou son adoption.
> Par ailleurs, en cas d’usage à des fins trompeuses ou frauduleuses, l'État se réserve le droit d’entreprendre les actions nécessaires pour y mettre un terme.
They mention the non-state-operated public sector and fraudulent use but not much beyond that.
> A simple way of determining whether to use type=number is to consider whether it would make sense for the input control to have a spinbox interface (e.g. with "up" and "down" arrows). Getting a credit card number wrong by 1 in the last digit isn't a minor mistake, it's as wrong as getting every digit incorrect. So it would not make sense for the user to select a credit card number using "up" and "down" buttons.
I don't think browsers can infer the semantic intent enough for this to be a fixable problem without some distinction in syntax.
I never used those except for testing to see what they do. They are always useless to me.
This happens to me accidentally while scrolling. Then I order the wrong quantity and such.
That said, I feel like the organizations behind HTML gave up too fast; they should have continued with input types for phone numbers (that e.g. phone manufacturers could then integrate with contacts without revealing anything to the website in question), credit card numbers (supporting all formats and with built-in format validation), etc. But they seem to have stopped 10+ years ago with HTML5's broken number input.
> 1. Accessibility
Here I agree with you that it feels like a workaround. Well, technically, it is not the browsers that need fixing, but rather Dragon Naturally Speaking and the NVDA screen reader.
> 2. Incrementable numbers (the fact that long series of digits get reinterpreted as large numbers, which causes all sort of issues, like them being reformatted in scientific 1.23e+45 notation)
Here instead it feels more like a legitimate things both on gov.uk's part and on the browser's part. "Numbers" and "long series of digits" are fundamentally different things, and it seems normal that they would be described with different input fields. (Now how those input fields should be named, that I am not qualified to have an opinion on.)
They do pretty extensive usability testing, and if I was a browser maker I'd listen to what they had to say.
You mean works with browser developers? Otherwise I can't see the reason why their site wouldn't work on modern browsers. Especially given the lengths they'll go to make sure it's as accessible as possible.
Edit: formatting
I don't want the browser to know or dictate what date format to use, that is the application's job, and the date input doesn't even let web applications specify the format. So you have a substantial engineering effort half implemented across a handful of browsers that approximately no one can use.
type="number" doesn't support thousands separators in any meaningful way.
type="date" and type="time" only display their values in the user's system locale, not the locale of the page. There's no way to change the format.
type="color" doesn't support RGBA and can't be in an empty state. If you try to unset its value, it always defaults to #000000, even in dark mode.
type="email" and similar text-like types don't offer any feedback for invalid values until you try to submit the form.
No wonder people are just using type="text" and relying on Javascript to achieve reasonable behavior.
Also, input type=email has been in Firefox, Chrome, and Safari for over a decade. It's not exactly new.
* a type=count which is used for specifying a "count of things". This is the only type that should display arrow up/down as the current type=number does. The arrows must be easy to remove because sometimes add/remove 1 does not make sense. To avoid problems with rounding, browsers must restrict min/max to be +/- 1e15 so the value always fits safely into a double (due to javascript numbers). Some people will have an objection to this, but how many times do you specify a count that is bigger than 1e15? Browsers could present an optimized UI (e.g. a dropdown) when e.g. min=0 and max=10.
* a type=digits which as default allows for digits, dashes, spaces. Useful for creditcard numbers. Having this as distinct type makes it easier to get good keypad on mobile.
* a type=price which is optimized for input for money as the general type might not be good at giving good error responses for "too many decimals". Could have currency as attribute for display on mobile input for countries which use multiple currencies and therefore having this displayed is important.
* a type=int which is used for integers to make it easy to make sure the number is an integer. Current html requires too many attributes for this common task.
* a type=number which is used for any other kind of number.
> The type=number state is not appropriate for input that happens to only consist of numbers but isn't strictly speaking a number.
sounds like silly self-contradictory nonsense, probably written by someone who didn’t know words like ‘digit’ or ‘quantity’, which would help tremendously to disambiguate this. (Ideally, it would have been <input type="quantity"> from the start, so that nobody would even think of using it for digit-based identifiers.)
Seriously, thesauri can be occasionally useful for something beyond sounding smug. (Not that it isn’t an advantage in itself…)
The disadvantage of the proposed solution is the lack of (automatic) feedback. Browsers tell you when the a number input exceeds the min/max range, in the browser's default language. If you want to validate a text input field and tell the user the number is too low or too high, you'll need to provide your own translated text.
You can use a type=number input and prevent bogus fractionals by setting the ‘step’ attribute on the input to ‘0.01’. This will do two things: the up/down clicker buttons will increment/decrement by 0.01, which IMO is all they’re useful for, and the browser should restrict values to two decimal spaces. Of course you still need to validate this on the backend.
https://news.ycombinator.com/item?id=22433654
I hereby coin the term "pseudo déjà vu" – when something feels like a déjà vu but its actually for real.
...isn't that just remembering?
So if you need a database field or a variable for such identifier, you should choose a string type, not numeric.