Smarter Link Underlines For Every Website
eager.io
eager.io
They also made the mistake of showing a link that includes the word "Typography", which has an underline so broken up and interrupted that it's distracting (which devindotcom also pointed out). It's linked, then it's not, then it's linked, then it's not!
So yeah, I have to give them credit for a good idea and a clever implementation, but it just doesn't work out in the end.
You and devindotcom did indeed bring up some good points, particularly about descender-heavy links, something I plan to take a crack at [2]. But I’m curious if you feel the entire strategy is flawed or if there’s just more work to be done. On a related note: if you’ve used/seen it, how do you feel about links in iOS 8 Safari? How do you feel about this before-and-after [3] (screenshot of the first paragraph of the blog post)?
[1]: https://eager.io/showcase/SmartUnderline/
Oh and if there's a way to apply this without requiring a background color, I suspect this might be a popular add-on or browser setting for some folks.
Including some aesthetics-stretching cases seems like a fairly honest/transparent thing to do for an open-source project that someone is blogging about.
> It breaks the semantics of what the underline means — any bit that's underlined is supposed to be the link, and if it's not underlined it's not a link.
That's a reasonable way to look at it, but humans like us can be pretty flexible with semantics, thanks to pragmatics. If I see a link that covers most of a set of letters stuck together without a space, I tend to assume that the whole thing is a click target. Even if my assumption is wrong, my clicking error rate probably won't be too high, since I think that people tend not to hit the edges of pointing task targets.
That's how I was taught to type underlines back in the 1980s on actual physical typewriters, so it's not a new idea.
I still do it today!
If one could apply a double-underline then the second, lower, line would be uninterrupted and make for a pleasing effect.
I would rather descenders weren't subsumed by the line either, but interrupting the element itself instead seems like as much as a problem as it is a solution.
I have a hunch using a faded color for the (possibly-then-thicker) underline would work better - the foreground descenders would retain distinction, without the noise of dotty/dashy line-ends.
Like is often the case with design, there are trade-offs. In this case I think the readability improvements to links with descenders outweighs the visual cue / scannability of links, particularly because I think links with more-descenders-than-non are not as common.
An interesting experiment might be to try to turn off the effect on words which fail some check (a high percentage of descender glyphs, for example). I created an issue on GitHub [1]—definitely something worth exploring. Thanks!
As an aside, I love Butterick's link style, what with the triangle and the background-changing color hovers, but that's too complicated for a general audience--especially one reading on the newest touch-screen whatsit that can't show you the "◊Amazon" word is actually a link to Amazon until you accidentally tap it.
But that's a great style for reading long-form articles because your brain isn't constantly interrupting you to say, "Ah, please compulsively hover over that underlined text so I can see what website this insightful blogpost is referencing."
To produce the iOS 8 version, I opened the page in Safari on iOS 8.1 pinched zoomed to the maximum amount while keeping all five links within the frame, and took a screenshot.
To produce the SmartUnderline version, I visited the SmartUnderline install page [2] in Google Chrome on Mac OS X, entered the test page URL, and clicked “Preview in a separate window”. With the screenshot from my iPhone opened next to the browser, I used Command+[+/-] to zoom the browser until the font sizes were the same size, then took a screenshot.
Here are the results: [3].
To summarize, I believe iOS 8 has some advantages and some disadvantages, but to me there is no clear winner.
Some specific points in no particular order:
- iOS underline breaks are always vertical cuts. Since SmartUnderline uses text-shadow to “white-out” the underline, the cut-outs are in the shape of the glyph. To me, this looks better in the “g” in “eager”, but worse in the “q” in “quitting”.
- iOS 8 shows a line between a “g” and ”y” (as in ”piggy”) and SmartUnderline does not.
- SmartUnderline’s underline extends less far to the left of the first letter and right of the last letter. This looks better in “quitting” and potentially worse in ”discovery”.
- In general, SmartUnderline sets a little more space around each descender.
- Both implementations show no underline before or after a leading or trailing “g”.
- Both implementations show the underline very close to the left side of the “y” descender. I think improvements could be made here with both implementations.
[1]: http://jsfiddle.net/adamschwartz/hyyerbq4/show/light/
[2]: https://eager.io/app/eA9ULux0UOJP/install
[3]: http://postimg.org/image/nf9b2ahd1/ (@2x http://postimg.org/image/688ricy2v/)
If you did use ligatures - derived from the typeface itself - then the hinting of the underline cuts can be better fitted to the face. But that assumes that the type designer themselves considered the case. So .. to me .. you're patching something upstream which might be better considered at the source: the font itself.
Using a border-bottom to achieve the look you’re describing is totally a valid preference. One potential advantage to the border-bottom technique is the way it can be used to make a link stand out. In fact, I use this link styling on my personal website for that reason [1].
(Note: when using a border-bottom, I’d recommend using a slightly larger line-height so that the line still seems associated with the text above it and not the text below it. This is one of the pitfalls described in the original Medium post [2].)
Unfortunately, aside from iOS 8, normal text-decoration underline links have the descender crossing problem.
I absolutely took this into consideration when designing SmartUnderline. SmartUnderline literally only applies itself to links with text-decoration underline, nothing else. It even tries to ensure other conditions which make the transformation favorable (display inline, solid background color, etc.).
Ultimately I think the before-and-after on the SmartUnderline website tells the best story [3]. No doubt one may appreciate other, very different link styles. (For example, just using a different text color to denote _link_ is a perfectly valid and commonly used technique.) But if you’re using text-decoration underline already, this just makes those links look better.
I think blogs, news articles and wikis are some of the primary examples of where these links look best. Anywhere where text is heavy and the links are _not_ the primary focus.
[2]: https://medium.com/designing-medium/crafting-link-underlines...
One note on your before and after, it's cool that you included arabic, but the right to left nature makes it look like the examples are reversed. Though I realize perhaps that was intentional.
Ha! Yeah, my co-founder and I debated that one... (he thought I should reverse it). I can see it both ways, but your comment certainly puts another vote in the reverse-it column. Thanks again :)
This seems like a big waste of CPU and memory. I don't want to drain my phone's battery rendering these underlines.
That being said, it’s definitely something worth considering, particularly since iOS 8 now implements descender-aware link underlines now. If there were a way to duck type for this feature, we’d definitely disable the JS anywhere we detect it working. Drawing an underlined “g” on a canvas and then reading the pixels at a certain location may work, but we haven’t tried it yet.
Traversing the enter style ruleset is possible but didn’t seem worth it for a library like this.
Another way is through a configuration option. Something like `SmartUnderline.init({ '.content a': 'hover' });` perhaps.
Case in point, the word giggly has what appear to be specs of dust underneath.
At first, the links in the "fragment" are invisible. You can toggle among that, single angle quotes (not used in English, which is why I picked that option), small bullet points on either end, and the default HTML underline.
The lack of any indicators at all was frustrating. I had to take physical action to determine whether something was a link. In practice I think I would just stop using the links. I think some kind of indication is needed.
The default underline was the best for me. I don't rule out that this is because I am used to the underlines. Going in I thought the dots would be bets, but I found them distracting. With practice they might be the best.
The angle brackets were by far the worst. It could be because I have seen enough HTML for angle brackets to have singificance, but I think it has more to do with parantheses and how we use them in text. I just found them distracting and they really took me out of the work.
Of the cuff thought... small superscripted dot or something? I'm used to seeing footnote or citation indicators in the corners and they generally don't take me out of whatever I'm reading.
> - It makes an assumption about selection color, which is OS- and browser-dependent.
> - Each smart-underlined link has 12 text-shadows drawn underneath it, which could potentially have performance penalties on mobile or older devices.
https://eager.io/showcase/SmartUnderline/
(Imho, the two points introduce enough risks and reasons to not use it and wait for OS- or browser-level updates instead.)
Unfortunately I imagine this is easier-said-than-done and may have to do more with the underlying typographical engines of OS-s than browsers. (I’m just guessing though.)
[edit] Obviously, it's a lot easier to fix this issue with a single font, as Apple has done in Messages, than to fix it well in every font.
With regards to this implementation, I'd rather not have to worry about the background, font and select background colors for every link. Applying text shadows over gradient-drawn underlines is an inspired hack that I'll have to remember, just in case, but I really wish there were a better way.
Maybe we should push for a 'text-mask-underline' CSS property that accepts radius, hardness and opacity values, in order to apply a fade to the underline around text descenders. [/edit]
[1] http://fontforge.github.io/fontinfo.html, http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=...
The fact that Apple decided to tackle this on iOS, an OS used on handheld devices which are typically viewed at closer distances, tells me that it’s something they feel is worth doing when you have the display resolution to do it right.
SmartUnderline makes a similar assumption, not applying itself to links with a small-enough font-size computed style.
With respect to your [edit] block:
> Obviously, it's a lot easier to fix this issue with a single font, as Apple has done in Messages.
Apple has implemented this throughout iOS 8, not just in Messages. Here’s a screenshot of Safari [1].
> I'd rather not have to worry about the background, font and select background colors for every link.
That’s actually the beauty of SmartUnderline. It figures all of these things out for you, automatically [2]. Please let us know if you run into any trouble though. :)
[1]: http://postimg.org/image/4ncgrezxr/
[2]: http://git.io/9YNfgg
If a background-image is specified, we abort [1]. (This would apply to CSS gradients as well.) Of course we’d like to support non-solid backgrounds at some point, but short of a true HTML-to-canvas solution, there’s not really that much better you can do without wreaking lots of havoc.
This absolutely still is prone to bugs when `position` or other properties are used to move elements visually outside of their parents, but it’s about as good as you can do without a true HTML-to-canvas implementation.
[1]: http://git.io/ChvO3Q
Instead, if CSS were developed by actual language designers, it would have been possible to write this as a modularized thing, completely hiding the actual implementation.
Are there particular aspects of this implementation you feel make it worse than Apple’s?
Ultimately we see this as an incremental improvement to the default text-decoration underline styling provided by most operating systems and browsers. However, we’re eager to work with OS community to improve this even further. Thanks again!
You may be able to fix that by tweaking the shadows but as it is currently implemented it works pretty well for larger display text but not so much for smaller body text.