Show HN: I wrote a book about UI [pdf]
Miscellaneous feedback from skimming through:<p>&gt; <i>Replace default file inputs with custom ones</i><p>Be careful with this. A non-trivial fraction of the custom file inputs that I’ve seen have been imperfect in ways that made me wish they’d stuck with the default. (This used to be a <i>much</i> more common problem; now it’s normally done right, or right enough.)<p>&gt; <i>Autofocus the first input input</i><p>Be careful with this. Focusing a field is disconcerting if the user didn’t expect or desire it: on desktop computers, Space is commonly used as equivalent to the Page Down key, but if you’ve focused something, it won’t do that; and on mobile devices, it’ll probably pop a keyboard open, perhaps blocking the user from seeing what’s actually going on. Only ever autofocus anything if an explicit user action has indicated they <i>certainly</i> want to interact with the form (some examples for the public internet: the user clicked a “log in” or “sign up” link, or you’re a search engine and they opened your front page; but if you’re an advertising landing page and have a form you want the user to fill out, <i>don’t</i> autofocus it; or if you have a search bar, <i>don’t</i> autofocus it).<p>if the page you’re loading has only the one If there’s anything else on the page, don’t autofocus anything.<p>I’d argue that most forms <i>shouldn’t</i> use autofocus.<p>(Also, s&#x2F;input input&#x2F;input&#x2F;. While I’m thinking of this, I noticed a “recuve” that I think should have been “reduce” earlier in the document.)<p>&gt; <i>Help users fill the form without errors</i><p>&gt; <i>3. In login&#x2F;signup forms provide social authentication methods.</i><p>That’s… quite a way out of scope for UI design considerations. Subjectively so, anyway.<p>&gt; <i>4. Use masks for such fields as dates and phone numbers so 
that users don&#x27;t guess the correct format.</i><p>Strong disagree, with prejudice. Masks are <i>evil</i>. Unqualifiedly so. It’s difficult to implement them in a way that won’t lead to unpleasant surprises <i>anywhere</i>, and outright impossible on the web. <i>Do not use masks.</i> Rather, prefer to validate and reshape data afterwards. e.g. accept all kinds of date formats, then on blur rewrite it to an unambiguous and well-understood format if possible, or at least a canonical and clearly-described format (e.g. for dates if you really want to put the month as a number rather than a name, make sure the order is clear, otherwise you’ll confuse either those pestiferous middle-endian people or the rest of the world).<p>&gt; <i>6. Limit the symbols that the input accepts. For zip code it&#x27;s reasonable to allow inputting only numbers.</i><p>Be careful with this. If you’re in the US, not all ZIP codes are just “five digits”: ZIP+4 codes are formatted like 12345-6789. If you’re in the UK, postcodes are alphanumeric. Oh yeah, also make sure with all of these things that you still represent them as strings, never numbers, or you’ll drop leading zeroes (e.g. in Australia, Darwin City is 0800) and probably run into validation problems in frontend, backend or mailing. Related: not all payment card numbers are 16 digits long. They can be 8–19 digits long.<p>&gt; <i>Show validation errors in the right place</i><p>But at the same time, make sure that the user can <i>find</i> the errors. I’ve definitely had forms where… there’s an error somewhere, but where is it?—because they didn’t make the styles clear enough.<p>&gt; <i>Put an overlay on images for better text contrast</i><p>Also consider blurring the image (in whole or in part). That’s very effective. For a detailed background image, a 30% black underlay and blur may be more effective than a 70% black underlay.<p>&gt; <i>You can quickly check the contrast level with chrome developer tools.</i><p>Wah, I dislike singling out just one browser. No idea about Safari, but Firefox has had this sort of stuff for a while too. (With these sorts of things, it’s a mixed bag as to which browser gets them first, but the other usually follows not long after.)<p>&gt; <i>Watch your shadows</i><p>The “good” example here actually shows a problem: the blur radius on the second box is too large and so sits on top of the first box. It’d be really nice if you could specify a different z-index for box-shadows to avoid this, but you can’t. So if your blur radius is large enough to collide with other containers, you have to be very careful about z-indexing. (If the shadow increases on interaction, like a hover effect, you may wish to pair that with a z-index bump so that the element draws on top of its previous and next siblings.)<p>&gt; <i>Don&#x27;t rely on dots in gallery sliders</i><p>… but at the same time, consider whether you want to keep the dots as a supplement to indicate position. Or some kind of M of N indicator. (I say <i>consider</i>; it may or may not be useful.)<p>&gt; <i>Label your icons</i><p>You can even try going further: see what it’s like if you ditch icons altogether in favour of labels. Often it works out nicer this way (though you’ll probably still want to keep icons in a few places, for well-standardised icons).<p>&gt; <i>Leverage empty states</i><p>But be careful with this: you should strongly prefer your empty state to guide the user to the UI that will persist after the empty state is no more, e.g. draw an arrow up to the “add new” button, rather than putting an add button in the empty state that will only appear that one time. It’s all about training the user.<p>&gt; <i>Use skeletons</i><p>Skeletons are drastically overused these days. You might not notice it if you’re in the USA, but come visit us in Australia (once COVID border restrictions are done!) and experience the high-latency internet, and you’ll get tired of seeing skeletons, especially animated ones. I’m going to glibly say: just make the stuff load faster, and come up with alternatives to skeletons. (“Don&#x27;t show loader right away” a couple of pages later deals with the periphery of this problem, thanks. s&#x2F;traction of seconds&#x2F;a fraction of a second&#x2F; there as well.)<p>&gt; <i>Button loading state</i><p>Ah, good times. I’ve designed a UI before where it would have multiple rows, each of which could have an “Add” or a “Remove” button, and I wanted them to be the same width, but it wasn’t a grid or anything. I settled for rendering both labels inside the button, with the false label given a height of zero (and hidden from screen readers too, don’t forget them). I was quite proud of the trick.<p>&gt; <i>It will give users some assurance that the app is working and not broken.</i><p>Except that I am very unlikely to believe the text, because I’m used to the idea that if it took longer than a few seconds, it’s probably not going to work, for various possible reasons (e.g. JS client error, network error, server error).<p>&gt; <i>Forbidding users to enter lengthy content by limiting the 
number of characters they can input</i><p>This is far too likely to backfire. Either you’ll upset people because the limit is too low and now they can’t enter something that they <i>need</i> to enter, or you haven’t actually solved the problem because someone keeps spamming ﷽ just because it’s typically so absurdly wide for a single Unicode scalar value. (And here I’m not even getting into the discussion of how you define “characters” in your limit.)<p>----<p>There are also quite a number of grammatical errors that you might want to look into dealing with.