|
|
|
|
|
by chrismorgan
2460 days ago
|
|
I have still never encountered a perfect masking implementation for the web. I don’t believe that they exist. If you think you know of one, please tell me and I’ll see how many seconds it takes me to find bugs in it. Normally it’s less than ten. I’ll be mightily impressed if someone can present me with one that I can’t find bugs in. Masking is generally surprisingly user-hostile. It’s better to instead take arbitrary user input and make sense of it after the fact—if you want to reformat the value they’ve entered, you might be able to get away with doing that after they blur the field (though even then there are often downsides to doing it), but I believe it’s genuinely impossible to accomplish in a side-effect way before then, across all devices. (It’s not easy, but possible to do it for desktop; but various mobile keyboards are particularly weird and do all kinds of crazy things if you meddle with the value while typing.) I’m talking about the web specifically here. It’s possible to do things properly outside the web, but the web just doesn’t give you quite the right tools for bug-free implementations of masking. |
|
This is particularly terrible for addresses. The only acceptable solution (that nobody uses) is as follows: allow FREEFORM addresses. Like, I'm OK with the website or the server doing some post-hoc validation, and suggesting to the user "This address doesn't seem right, are you sure it is correct?" But the amount of time I have to enter "county" (or whatever) for my London address (and sometimes it's Greater London, other times just London, or probably something else as well...) is ridiculous, doubly so because mail in the UK arrives without problems with little more than just a postcode.