4 ms·
In 26 years of web dev, mostly as a frontend person, I've only seen zero width spaces in three situations - pasting from Word - QA testers being through - de
by onion2k 2y ago
In 26 years of web dev, mostly as a frontend person, I've only seen zero width spaces in three situations
- pasting from Word
- QA testers being through
- devs pranking each other
The third one is by far the most common. Word is much better these days and I've not seen that happen in a long time. I wish I saw QA test this stuff more often. The idea that it's common enough that you'd break your UX to handle it baffling to me.
- francislavoie 2y ago"Break your UX" is a vast exaggeration. I'm not talking about phone number fields, to be clear. I'm talking about like numeric amounts, with maybe a negative or decimal point. It's literally just [0-9\.-] but that still requires JS to limit inputs to that.
- HappMacDonald 2y agoWhat's wrong with <input type="text" pattern="[0-9.-]*"> though?
- francislavoie 2y agoIt doesn't prevent the bad input, it only validates it on submission. Therefore it's on the user to fix it, and if it's from a zero-width space, it's literally invisible. Non-technical users will have no idea what to look for to fix it (i.e. use your arrow keys cursor to see at which character the arrow key doesn't shift visually, and there's the ZWSP). It happens way too often.
- deleted 2y ago[deleted]
- jcelerier 2y agoI see weird spaces every time I copy-paste from some pdf pretty much, especially if it's a digitised or 10+ years one. Hardly an irrelevant use case
- lomase 2y agoAdd to that pasting from MS Teams.
- ragnese 2y agoI'll be one of those guys. I see the invisible whitespace from pasting ALL the time. I've literally dealt with user complaints caused by it three times in the last two weeks! (Usually customer issues don't make it to me unless our support team can't figure it out or suspects a bug) To be fair, it's not usually that frequent. Just a funny coincidence that I've JUST dealt with it more recently.
- 71bw 2y agoTry copying any string from any e-mail.