1,532 karma · joined August 23, 2012
Here are some of the other targets that are on deck: https://git.io/vi8IK.
If there are any others not on that list you’d like to see added, please let us know or create an issue on GitHub. Thanks again!
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
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/)
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.
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.
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
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/
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!
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!
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.)
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.
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 :)
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...