Jeremy Keith's Blog, page 70
July 11, 2018
Links, tags, and feeds
A little while back, I switched from using Chrome as my day-to-day browser to using Firefox. I could feel myself getting a bit too comfortable with one particular browser, and that’s not good. I reckon it’s good to shake things up a little every now and then. Besides, there really isn’t that much difference once you’ve transferred over bookmarks and cookies.
Unfortunately I’m being bitten by this little bug in Firefox. It causes some of my bookmarklets to fail on certain sites with strict Content Security Policies (and CSPs shouldn’t affect bookmarklets). I might have to switch back to Chrome because of this.
I use bookmarklets throughout the day. There’s the Huffduffer bookmarklet, of course, for whenever I come across a podcast episode or other piece of audio that I want to listen to later. But there’s also my own home-rolled bookmarklet for posting links to my site. It doesn’t do anything clever���it grabs the title and URL of the currently open page and pre-populates a form in a new window, leaving me to add a short description and some tags.
If you’re reading this, then you’re familiar with the “journal” section of adactio.com, but the “links” section is where I post the most. Here, for example, are all the links I posted yesterday. It varies from day to day, but there’s generally a handful.
Should you wish to keep track of everything I’m linking to, there’s a twitterbot you can follow called @adactioLinks. It uses a simple IFTTT recipe to poll my RSS feed of links and send out a tweet whenever there’s a new entry.
Or you can drink straight from the source and subscribe to the RSS feed itself, if you’re still rocking it old-school. But if RSS is your bag, then you might appreciate a way to filter those links…
All my links are tagged. Heavily. This is because all my links are “notes to future self”, and all my future self has to do is ask “what would past me have tagged that link with?” when I’m trying to find something I previously linked to. I end up using my site’s URLs as an interface:
adactio.com/links/tags/serviceworkers or
adactio.com/links/tags/sci-fi
At the front-end gatherings at Clearleft, I usually wrap up with a quick tour of whatever I’ve added that week to:
adactio.com/links/tags/frontend
Well, each one of those tags also has a corresponding RSS feed:
adactio.com/links/tags/serviceworkers/rss
adactio.com/links/tags/sci-fi/rss
adactio.com/links/tags/frontend/rss
…and so on.
That means you can subscribe to just the links tagged with something you’re interested in. Here’s the full list of tags if you’re interested in seeing the inside of my head.
This also works for my journal entries. If you’re only interested in my blog posts about frontend development, you might want to subscribe to:
adactio.com/journal/tags/frontend/rss
Here are all the tags from my journal.
You can even mix them up. For everything I’ve tagged with “typography”���whether it’s links, journal entries, or articles���the URL is:
adactio.com/tags/typography
The corresponding RSS feed is:
adactio.com/tags/typography/rss
You get the idea. Basically, if something on my site is a list of items, chances are there’s a corresponding RSS feeds. Sometimes there might even be a JSON feed. Hack some URLs to see.
Meanwhile, I’ll be linking, linking, linking…
July 10, 2018
Twitter and Instagram progressive web apps
Since support for service workers landed in Mobile Safari on iOS, I’ve been trying a little experiment. Can I replace some of the native apps I use with progressive web apps?
The two major candidates are Twitter and Instagram. I added them to my home screen, and banished the native apps off to a separate screen. I’ve been using both progressive web apps for a few months now, and I have to say, they’re pretty darn great.
There are a few limitations compared to the native apps. On Twitter, if you follow a link from a tweet, it pops open in Safari, which is fine, but when you return to Twitter, it loads anew. This isn’t any fault of Twitter���this is the way that web apps have worked on iOS ever since they introduced their weird web-app-capable meta element. I hope this behaviour will be fixed in a future update.
Also, until we get web notifications on iOS, I need to keep the Twitter native app around if I want to be notified of a direct message (the only notification I allow).
Apart from those two little issues though, Twitter Lite is on par with the native app.
Instagram is also pretty great. It too suffers from some navigation issues. If I click through to someone’s profile, and then return to the main feed, it also loads it anew, losing my place. It would be great if this could be fixed.
For some reason, the Instagram web app doesn’t allow uploading multiple photos …which is weird, because I can upload multiple photos on my own site by adding the multiple attribute to the input type="file" in my posting interface.
Apart from that, though, it works great. And as I never wanted notifications from Instagram anyway, the lack of web notifications doesn’t bother me at all. In fact, because the progressive web app doesn’t keep nagging me about enabling notifications, it’s a more pleasant experience overall.
Something else that was really annoying with the native app was the preponderance of advertisements. It was really getting out of hand.
Well …(looks around to make sure no one is listening)… don’t tell anyone, but the Instagram progressive web app���i.e. the website���doesn’t have any ads at all!
Here’s hoping it stays that way.
Components and concerns
We tend to like false dichotomies in the world of web design and web development. I’ve noticed one recently that keeps coming up in the realm of design systems and components.
It’s about separation of concerns. The web has a long history of separating structure, presentation, and behaviour through HTML, CSS, and JavaScript. It has served us very well. If you build in that order, ensuring that something works (to some extent) before adding the next layer, the result will be robust and resilient.
But in this age of components, many people are pointing out that it makes sense to separate things according to their function. Here’s the Diana Mounter in her excellent article about design systems at Github:
Rather than separating concerns by languages (such as HTML, CSS, and JavaScript), we���re are working towards a model of separating concerns at the component level.
This echoes a point made previously in a slidedeck by Cristiano Rastelli.
Separating interfaces according to the purpose of each component makes total sense …but that doesn’t mean we have to stop separating structure, presentation, and behaviour! Why not do both?
There’s nothing in the “traditonal” separation of concerns on the web (HTML/CSS/JavaScript) that restricts it only to pages. In fact, I would say it works best when it’s applied on smaller scales.
In her article, Pattern Library First: An Approach For Managing CSS, Rachel advises starting every component with good markup:
Your starting point should always be well-structured markup.
This ensures that your content is accessible at a very basic level, but it also means you can take advantage of normal flow.
That’s basically an application of starting with the rule of least power.
In chapter 6 of Resilient Web Design, I outline the three-step process I use to build on the web:
Identify core functionality.
Make that functionality available using the simplest possible��technology.
Enhance!
That chapter is filled with examples of applying those steps at the level of an entire site or product, but it doesn’t need to end there:
We can apply the three���step process at the scale of individual components within a page. ���What is the core functionality of this component? How can I make that functionality available using the simplest possible technology? Now how can I enhance��it?���
There’s another shared benefit to separating concerns when building pages and building components. In the case of pages, asking “what is the core functionality?” will help you come up with a good URL. With components, asking “what is the core functionality?” will help you come up with a good name …something that’s at the heart of a good design system. In her brilliant Design Systems book, Alla advocates asking “what is its purpose?” in order to get a good shared language for components.
My point is this:
Separating structure, presentation, and behaviour is a good idea.
Separating an interface into components is a good idea.
Those two good ideas are not in conflict. Presenting them as though they were binary choices is like saying “I used to eat Italian food, but now I drink Italian wine.” They work best when they’re done in combination.
July 5, 2018
The trimCache function in Going Offline
Paul Yabsley wrote to let me know about an error in Going Offline. It���s rather embarrassing because it���s code that I���m using in the service worker for adactio.com but for some reason I messed it up in the book.
It���s the trimCache function in Chapter 7: Tidying Up. That���s the reusable piece of code that recursively reduces the number of items in a specified cache (cacheName) to a specified amount (maxItems). On page 95 and 96 I describe the process of creating the function which, in the book, ends up like this:
function trimCache(cacheName, maxItems) {
cacheName.open( cache => {
cache.keys()
.then( items => {
if (items.length > maxItems) {
cache.delete(items[0])
.then(
trimCache(cacheName, maxItems)
); // end delete then
} // end if
}); // end keys then
}); // end open
} // end function
See the problem? It���s right there at the start when I try to open the cache like this:
cacheName.open( cache => {
That won���t work. The open method only works on the caches object���I should be passing the name of the cache into the caches.open method. So the code should look like this:
caches.open( cacheName )
.then( cache => {
Everything else remains the same. The corrected trimCache function is here:
function trimCache(cacheName, maxItems) {
caches.open(cacheName)
.then( cache => {
cache.keys()
.then(keys => {
if (keys.length > maxItems) {
cache.delete(keys[0])
.then(
trimCache(cacheName, maxItems)
); // end delete then
} // end if
}); // end keys then
}); // end open then
} // end function
Sorry about that! I must���ve had some kind of brainfart when I was writing (and describing) that one line of code.
You may want to deface your copy of Going Offline by taking a pen to that code example. Normally I consider the practice of writing in books to be barbarism, but in this case ���go for it.
July 2, 2018
Speaking my brains in Boston
I was in Boston last week to give a talk. I ended up giving four.
I was there for An Event Apart which was, as always, excellent. I opened up day two with my talk, The Way Of The Web.
This was my second time giving this talk at An Event Apart���the first time was in Seattle a few months back. It was also my last time giving this talk at An Event Apart���I shan’t be speaking at any of the other AEAs this year, alas. The talk wasn’t recorded either so I’m afraid you kind of had to be there (unless you know of another conference that might like to have me give that talk, in which case, hit me up).
After giving my talk in the morning, I wasn’t quite done. I was on a panel discussion with Rachel about CSS grid. It turned out to be a pretty good format: have one person who’s a complete authority on a topic (Rachel), and another person who’s barely starting out and knows just enough to be dangerous (me). I really enjoyed it, and the questions from the audience prompted some ideas to form in my head that I should really note down in a blog post before they evaporate.
The next day, I went over to MIT to speak at Design 4 Drupal. So, y’know, technically I’ve lectured at MIT now.
I wasn’t going to do the same talk as I gave at An Event Apart, obviously. Instead, I reprised the talk I gave earlier this at Webstock: Taking Back The Web. I thought it was fitting given how much Drupal’s glorious leader, Dries, has been thinking about, writing about, and building with the indie web.
I really enjoyed giving this talk. The audience were great, and they had lots of good questions afterwards. There’s a video, which is basically my voice dubbed over the slides, followed by a good half of questions afterwards.
When I was done there, after a brief excursion to the MIT bookstore, I went back across the river from Cambridge to Boston just in time for that evening’s Boston CSS meetup.
Lea had been in touch to ask if I would speak at this meet-up, and I was only too happy to oblige. I tried doing something I’ve never done before: a book reading!
No, not reading from Going Offline, my current book which I should encouraging people to buy. Instead I read from Resilient Web Design, the free online book that people literally couldn’t buy if they wanted to. But I figured reading the philosophical ramblings in Resilient Web Design would go over better than trying to do an oral version of the service worker code in Going Offline.
I read from chapters two (Materials), three (Visions), and five (Layers) and I really, really liked doing it! People seemed to enjoy it too���we had questions throughout.
And with that, my time in Boston was at an end. I was up at the crack of dawn the next morning to get the plane back to England where Ampersand awaited. I wasn’t speaking there though. I thoroughly enjoyed being an attendee and absorbing the knowledge bombs from the brilliant speakers that Rich assembled.
The next place I’m speaking will much closer to home than Boston: I’ll be giving a short talk at Oxford Geek Nights on Wednesday. Come on by if you’re in the neighbourhood.
June 26, 2018
Name That Script! by Trent Walton
Trent is about to pop his AEA cherry and give a talk at An Event Apart in Boston. I���m going to attempt to liveblog this:
How many third-party scripts are loading on our web pages these days? How can we objectively measure the value of these (advertising, a/b testing, analytics, etc.) scripts���considering their impact on web performance, user experience, and business goals? We���ve learned to scrutinize content hierarchy, browser support, and page speed as part of the design and development process. Similarly, Trent will share recent experiences and explore ways to evaluate and discuss the inclusion of 3rd-party scripts.
Trent is going to speak about third-party scripts, which is funny, because a year ago, he never would���ve thought he���d be talking about this. But he realised he needed to pay more attention to:
any request made to an external URL.
Or how about this:
A resource included with a web page that the site owner doesn���t explicitly control.
When you include a third-party script, the third party can change the contents of that script.
Here are some uses:
advertising,
A/B testing,
analytics,
social media,
content delivery networks,
customer interaction,
comments,
tag managers,
fonts.
You get data from things like analytics and A/B testing. You get income from ads. You get content from CDNs.
But Trent has concerns. First and foremost, the user experience effects of poor performance. Also, there are the privacy implications.
Why does Trent���a designer���care about third party scripts? Well, over the years, the areas that Trent pays attention to has expanded. He���s progressed from image comps to frontend to performance to accessibility to design systems to the command line and now to third parties. But Trent has no impact on those third-party scripts. That���s very different to all those other areas.
Trent mostly builds prototypes. Those then get handed over for integration. Sometimes that means hooking it up to a CMS. Sometimes it means adding in analytics and ads. It gets really complex when you throw in third-party comments, payment systems, and A/B testing tools. Oftentimes, those third-party scripts can outweigh all the gains made beforehand. It happens with no discussion. And yet we spent half a meeting discussing a border radius value.
Delivering a performant, accessible, responsive, scalable website isn���t enough: I also need to consider the impact of third-party scripts.
Trent has spent the last few months learning about third parties so he can be better equiped to discuss them.
UX, performance and privacy impact
We feel the UX impact every day we browse the web (if we turn off our content blockers). The Food Network site has an intersitial asking you to disable your ad blocker. They promise they won���t spawn any pop-up windows. Trent turned his ad blocker off���the page was now 15 megabytes in size. And to top it off ���he got a pop up.
Privacy can harder to perceive. We brush aside cookie notifications. What if the wording was ���accept trackers��� instead of ���accept cookies���?
Remarketing is that experience when you���re browsing for a spatula and then every website you visit serves you ads for spatula. That might seem harmless but allowing access to our browsing history has serious privacy implications.
Web builders are on the front lines. It���s up to us to advocate for data protection and privacy like we do for web standards. Don���t wait to be told.
Categories of third parties
Ghostery categories third-party providers: advertising, comments, customer interaction, essential, site analytics, social media. You can dive into each layer and see the specific third-party services on the page you���re viewing.
Analyse and itemise third-party scripts
We have ���view source��� for learning web development. For third parties, you need some tool to export the data. HAR files (HTTP ARchive) are JSON files that you can create from most browsers��� network request panel in dev tools. But what do you do with a .har file? The site har.tech has plenty of resources for you. That���s where Trent found the Mac app, Charles. It can open .har files. Best of all, you can export to CSV so you can share spreadsheets of the data.
You can visualise third-party requests with Simon Hearne���s excellent Request Map. It���s quite impactful for delivering a visceral reaction in a meeting���so much more effective than just saying ���hey, we have a lot of third parties.��� Request Map can also export to CSV.
Know industry averages
Trent wanted to know what was ���normal.” He decided to analyse HAR files for Alexa���s top 50 US websites. The result was a massive spreadsheet of third-party providers. There were 213 third-party domains (which is not even the same as the number of requests). There was an average of 22 unique third-party domains per site. The usual suspects were everywhere���Google, Amazon, Facebook, Adobe���but there were many others. You can find an alphabetical index on better.fyi/trackers. Often the lesser-known domains turn out to be owned by the bigger domains.
News sites and shopping sites have the most third-party scripts, unsurprisingly.
Understand benefits
Trent realised he needed to listen and understand why third-party scripts are being included. He found out what tag managers do. They���re funnels that allow you to cram even more third-party scripts onto your website. Trent worried that this was a Pandora���s box. The tag manager interface is easy to access and use. But he was told that it���s more like a way of organising your third-party scripts under one dashboard. But still, if you get too focused on the dashboard, you could lose focus of the impact on load times. So don���t blame the tool: it���s all about how it���s used.
Take action
Establish a centre of excellence. Put standards in place���in a cross-discipline way���to define how third-party scripts are evaluated. For example:
Determine the value to the business.
Avoid redundant scripts and services.
Fit within the established performance budget.
Comply with the organistional privacy policy.
Document those decisions, maybe even in your design system.
Also, include third-party scripts within your prototypes to get a more accurate feel for the performance implications.
On a live site, you can regularly audit third-party scripts on a regular basis. Check to see if any are redundant or if they���re exceeding the performance budget. You can monitor performance with tools like Calibre and Speed Curve to cover the time in between audits.
Make your case
Do competitive analysis. Look at other sites in your sector. It���s a compelling way to make a case for change. WPO Stats is very handy for anecdata.
You can gather comparative data with Web Page Test: you can run a full test, and you can run a test with certain third parties blocked. Use the results to kick off a discussion about the impact of those third parties.
Talk it out
Work to maintain an ongoing discussion with the entire team. As Tim Kadlec says:
Everything should have a value, because everything has a cost.
Building More Expressive Products by Val Head
It���s day two of An Event Apart in Boston and Val is giving a new talk about building expressive products:
The products we design today must connect with customers across different screen sizes, contexts, and even voice or chat interfaces. As such, we create emotional expressiveness in our products not only through visual design and language choices, but also through design details such as how interface elements move, or the way they sound. By using every tool at our disposal, including audio and animation, we can create more expressive products that feel cohesive across all of today���s diverse media and social contexts. In this session, Val will show how to harness the design details from different media to build overarching themes���themes that persist across all screen sizes and user and interface contexts, creating a bigger emotional impact and connection with your audience.
I���m going to attempt to live blog her talk. Here goes���
This is about products that intentionally express personality. When you know what your product���s personality is, you can line up your design choices to express that personality intentionally (as opposed to leaving it to chance).
Tunnel Bear has a theme around a giant bear that will product you from all the bad things on the internet. It makes a technical product very friendly���very different from most VPN companies.
Mailchimp have been doing this for years, but with a monkey (ape, actually, Val), not a bear���Freddie. They���ve evolved and changed it over time, but it always has personality.
But you don���t need a cute animal to express personality. Authentic Weather is a sarcastic weather app. It���s quite sweary and that stands out. They use copy, bold colours, and giant type.
Personality can be more subtle, like with Stripe. They use slick animations and clear, concise design.
Being expressive means conveying personality through design. Type, colour, copy, layout, motion, and sound can all express personality. Val is going to focus on the last two: motion and sound.
Expressing personality with motion
Animation can be used to tell your story. We can do that through:
Easing choices (ease-in, ease-out, bounce, etc.),
Duration values, and offsets,
The properties we animate.
Here are four personality types���
Calm, soft, reassuring
You can use opacity, soft blurs, small movements, and easing curves with gradual changes. You can use:
fade,
scale + fade,
blur + fade,
blur + scale + fade.
Pro tip for blurs: the end of blurs always looks weird. Fade out with opacity before your blur gets weird.
You can use Penner easing equations to do your easings. See them in action on easings.net. They���re motion graphs plotting animation against time. The flatter the curve, the more linear the motion. They have a lot more range than the defaults you get with CSS keyword values.
For calm, soft, and reassuring, you could use easeInQuad, easeOutQuad, or easeInOutQuad. But that���s like saying ���you could use dark blue.��� These will get you close, but you need to work on the detail.
Confident, stable, strong
You can use direct movements, straight lines, symmetrical ease-in-outs. You should avoid blurs, bounces, and overshoots. You can use:
quick fade,
scale + fade,
direct start and stops.
You can use Penner equations like easeInCubic, easeOutCubic and easeInOutCubic.
Lively, energetic, friendly
You can use overshoots, anticipation, and ���snappy” easing curves. You can use:
overshoot,
overshoot + scale,
anticipation,
anticipation + overshoot
To get the sense of overshoots and anticipations you can use easing curves like easeInBack, easeOutBack, and easeInOutBack. Those aren���t the only ones though. Anything that sticks out the bottom of the graph will give you anticipation. Anything that sticks out the top of the graph will give you overshoot.
If cubic bezier curves don���t get you quite what you���re going for, you can add keyframes to your animation. You could have keyframes for: 0%, 90%, and 100% where the 90% point is past the 100% point.
Stripe uses a touch of overshoot on their charts and diagrams; nice and subtle. Slack uses a bit of overshoot to create a sense of friendliness in their loader.
Playful, fun, lighthearted
You can use bounces, shape morphs, squashes and stretches. This is probably not the personality for a bank. But it could be for a game, or some other playful product. You can use:
bounce,
elastic,
morph,
squash and stretch (springs.
You can use easing equations for the first two, but for the others, they���re really hard to pull off with just CSS. You probably need JavaScript.
The easing curve for elastic movement is more complicated Penner equation that can���t be done in CSS. GreenSock will help you visual your elastic easings. For springs, you probably need a dedicated library for spring motions.
Expressing personality with sound
We don���t talk about sound much in web design. There are old angry blog posts about it. And not every website should use sound. But why don���t we even consider it on the web?
We were burnt by those terrible Flash sites with sound on every single button mouseover. And yet the Facebook native app does that today ���but in a much more subtle way. The volume is mixed lower, and the sound is flatter; more like a haptic feel. And there���s more variation in the sounds. Just because we did sound badly in the past doesn���t mean we can���t do it well today.
People say they don���t want their computers making sound in an office environment. But isn���t responsive design all about how we don���t just use websites on our desktop computers?
Amber Case has a terrific book about designing products with sound, and she���s all about calm technology. She points out that the larger the display, the less important auditive and tactile feedback becomes. But on smaller screens, the need increases. Maybe that���s why we���re fine with mobile apps making sound but not with our desktop computers doing it?
People say that sound is annoying. That���s like saying siblings are annoying. Sound is annoying when it���s:
not appropriate for the situation,
played at the wrong time,
too loud,
lacks user control.
But all of those are design decisions that we can control.
So what can we do with sound?
Sound can enhance what we perceive from animation. The ���breathe” mode in the Calm meditation app has some lovely animation, and some great sound to go with it. The animation is just a circle getting smaller and bigger���if you took the sound away, it wouldn���t be very impressive.
Sound can also set a mood. Sirin Labs has an extreme example for the Solarin device with futuristic sounds. It���s quite reminiscent of the Flash days, but now it���s all done with browser technologies.
Sound is a powerful brand differentiator. Val now plays sounds (without visuals) from:
Slack,
Outlook Calendar.
They have strong associations for us. These are earcons: icons for the ears. They can be designed to provoke specific emotions. There was a great explanation on the Blackberry website, of all places (they had a whole design system around their earcons).
Here are some uses of sounds���
Alerts and notifications
You have a new message. You have new email. Your timer is up. You might not be looking at the screen, waiting for those events.
Navigating space
Apple TV has layers of menus. You go ���in” and ���out” of the layers. As you travel ���in” and ���out”, the animation is reinforced with sound���an ���in” sound and an ���out” sound.
Confirming actions
When you buy with Apple Pay, you get auditory feedback. Twitter uses sound for the ���pull to refresh��� action. It gives you confirmation in a tactile way.
Marking positive moments
This is a great way of making a positive impact in your user���s minds���celebrate the accomplishments. Clear���by Realmac software���gives lovely rising auditory feedback as you tick things off your to-do list. Compare that to hardware products that only make sounds when something goes wrong���they don���t celebrate your accomplishments.
Here are some best practices for user interface sounds:
UI sounds be short, less than 400ms.
End on an ascending interval for positive feedback or beginnings.
End on a descending interval for negative feedback, ending, or closing.
Give the user controls to top or customise the sound.
When it comes to being expressive with sounds, different intervals can evoke different emotions:
Consonant intervals feel pleasant and positive.
Dissonant intervals feel strong, active, or negative.
Large intervals feel powerful.
Octaves convey lightheartedness.
People have made sounds for you if you don���t want to design your own. Octave is a free library of UI sounds. You can buy sounds from motionsound.io, targetted specifically at sounds to go with motions.
Let���s wrap up by exploring where to find your product���s personality:
What is it trying to help users accomplish?
What is it like? (its mood and disposition)
You can workshops to answer these questions. You can also do research with your users. You might have one idea about your product���s personality that���s different to your customer���s. You need to project a believable personality. Talk to your customers.
Designing for Emotion has some great exercises for finding personality. Conversational Design also has some great exercises in it. Once you have the words to describe your personality, it gets easier to design for it.
So have a think about using motion and sound to express your product���s personality. Be intentional about it. It will also make the web a more interesting place.
June 25, 2018
Why Design Systems Fail by Una Kravets
I’m at An Event Apart Boston where Una is about to talk about design systems, following on from Yesenia’s excellent design systems talk. I’m going to attempt to liveblog it…
Una works at the Bustle Digital Group, which publishes a lot of different properties. She used to work at Watson, at Bluemix and at Digital Ocean. They all have something in common (other than having blue in their logos). They all had design systems that failed.
Design systems are so hot right now. They allow us think in a componentised way, and grow quickly. There are plenty of examples out there, like Polaris from Shopify, the Lightning design sytem from Salesforce, Garden from Zendesk, Gov.uk, and Code For America. Check out Anna’s excellent styleguides.io for more examples.
What exactly is a design system?
It’s a broad term. It can be a styleguide or visual pattern library. It can be design tooling (like a Sketch file). It can be a component library. It can be documentation of design or development usage. It can be voice and tone guidelines.
Styleguides
When Una was in College, she had a print rebranding job���letterheads, stationary, etc. She also had to provide design guidelines. She put this design guide on the web. It had colours, heading levels, type, logo treatments, and so on. It wasn’t for an application, but it was a design system.
Design tooling
Primer by Github is a good example of this. You can download pre-made icons, colours, etc.
Component library
This is where you get the code. Una worked on BUI at Digital Ocean, which described the interaction states of each components and how to customise interactions with JavaScript.
Code usage guidelines
AirBnB has a really good example of this. It’s a consistent code style. You can even include it in your build step with eslint-config-airbnb and stylelint-config-airbnb.
Design usage documentation
Carbon by IBM, built on the history of IBM’s magnetic tape machines and typewriters.
Voice and tone guidelines
Of course Mailchimp is the classic example here. They break up voice and tone. Voice is not just what the company is, but what the company is not:
Fun but not silly,
Confident but not cocky,
Smart but not stodgy,
and so on.
Voiceandtone.com describes the user’s feelings at different points and how to communicate with them. There are guidelines for app users, and guidelines for readers of the company newsletter, and guidelines for readers of the blog, and so on. They even have examples of when things go wrong. The guidelines provide tips on how to help people effectively.
Why do design systems fail?
Una now asks who in the room has ever started a diet. And who has ever finished a diet? (A lot of hands go down).
Nobody uses it
At Digital Ocean, there was a design system called Buoy version 1. Una helped build a design system called Float. There was also a BUI version 2. Buoy was for product, Float was for the marketing site. Classic example of 927. Nobody was using them.
Una checked the CSS of the final output and the design system code only accounted for 28% of the codebase. Most of the CSS was over-riding the CSS in the design system.
Happy design systems scale good standards, unify component styles and code and reduce code cruft. Why were people adding on instead of using the existing sytem? Because everyone was being judged on different metrics. Some teams were judged on shipping features rather than producing clean code. So the advantages of a happy design systems don’t apply to them.
Investment
It’s like going to the gym. Small incremental changes make a big difference over the long term. If you just work out for three months and then stop, you’ll lose all your progress. It’s like that with design systems. They have to stay in sync with the live site. If you don’t keep it up to date, people just won’t use it.
It’s really important to have a solid core. Accessibility needs to be built in from the start. And the design system needs ownership and dedicated commitment. That has to come from the organisation.
You have to start somewhere.
Communication
Communication is multidimensional; it’s not one-way. The design system owner (or team) needs to act as a bridge between designers and developers. Nobody likes to be told what to do. People need to be involved, and feel like their needs are being addressed. Make people feel like they have control over the process …even if they don’t; it’s like perceived performance���this is perceived involvement.
Ask. Listen. Make your users feel heard. Incorporate feedback.
Buy-in
Good communication is important for getting buy-in from the people who will use the design system. You also need buy-in from the product owners.
Showing is more powerful than telling. Hackathans are like candy to a budding design system���a chance to demonstrate the benefits of a design system (and get feedback). After a hackathon at Digital Ocean, everyone was talking about the design system. Weeks afterwards, one of the developers replaced Bootstrap with BUI, removing 20,000 lines of code! After seeing the impact of a design system, the developers will tell their co-workers all about it.
Solid architecture
You need to build with composability and change in mind. Primer, by Github, has a core package, and then add-ons for, say, marketing or product. That separation of concerns is great. BUI used a similar module-based approach: a core codebase, separate from iconography and grid.
Semantic versioning is another important part of having a solid architecture for your design system. You want to be able to push out minor updates without worrying about breaking changes.
Major.Minor.Patch
Use the same convention in your design files, like Sketch.
What about tech stack choice? Every company has different needs, but one thing Una recommends is: don’t wait to namespace! All your components should have some kind of prefix in the class names so they don’t clash with existing CSS.
Una mentions Solid by Buzzfeed, which I personally think is dreadful (count the number of !important declarations���you can call it “immutable” all you want).
AtlasKit by Atlassian goes all in on React. They’re trying to integrate Sketch into it, but design tooling isn’t solved yet (AirBnB are working on this too). We’re still trying to figure out how to merge the worlds of design and code.
Reduce Friction
This is what it’s all about. Using the design system has to be the path of least resistance. If the new design system is harder to use than what people are already doing, they won’t use it.
Provide hooks and tools for the people who will be using the design system. That might be mixins in Sass or it might be a script on a CDN that people can just link to.
Start early, update often. Design systems can be built retrospectively but it’s easier to do it when a new product is being built.
Bugs and cruft always increase over time. You need a mechanism in place to keep on top of it. Not just technical bugs, but visual inconsistencies.
So the five pillars of ensuring a successful design system are:
Investment
Communication
Buy-in
Solid architecture
Reduce friction
When you’re starting, begin with a goal:
We are building a design system because…
Then review what you’ve already got (your existing codebase). For example, if the goal of having a design system is to increase page performance, use Web Page Test to measure how the current site is performing. If the goal is to reduce accessibility problems, use webaim.org to measure the accessibility of your current site (see also: pa11y). If the goal is to reduce the amount of CSS in your codebase, use cssstats.com to test how your current site is doing. Now that you’ve got stats, use them to get buy-in. You can also start by doing an interface inventory. Print out pages and cut them up.
Once you’ve got buy-in and commitment (in writing), then you can make technical decisions.
You can start with your atomic elements. Buttons are like the “Hello world!” of design systems. You’ve colours, type, and different states.
Then you can compose elements by putting the base elements together.
Do you include layout in the system? That’s a challenge, and it depends on your team. If you do include layout, to what extent?
Regardless of layout, you still need to think about space: the space between base elements within a component.
Bake in accessibility: every hover state should have an equal (not opposite) focus state.
Think about states, like loading states.
Then you can start documenting. Then inform the users of the system. Carbon has a dashboard showing which components are new, which components are deprecated, and which components are being updated.
Keep consistent communication. Design and dev communication has to happen. Continuous iteration, support and communication are the most important factors in the success of a design system. Code is only 10% of a sytem.
Also, don’t feel like you need to copy other design systems out there. Your needs are probably very different. As Diana says, comparing your design system to the polished public ones is like comparing your life to someone’s Instagram account. To that end, Una says something potentially contraversial:
You might not need a design sytem.
If you’re the only one at your organisation that cares about the benefits of a design system, you won’t get buy-in, and if you don’t get buy-in, the design system will fail. Maybe there’s something more appropriate for your team? After all, not everyone needs to go to the gym to get fit. There are alternatives.
Find what works for you and keep at it.
June 23, 2018
New tools for art direction on the web
I’m in Boston right now, getting ready to speak at An Event Apart. This will be my second (and last) Event Apart of the year���the other time was in Seattle back in April. After that event, I wrote about how inspired I was:
It was interesting to see repeating, overlapping themes. From a purely technical perspective, three technologies that were front and centre were:
CSS grid,
variable fonts, and
service workers.
From listening to other attendees, the overwhelming message received was ���These technologies are here���they���ve arrived.���
I was itching to combine those technologies on a project. Coincidentally, it was around that time that I started planning to publish The G��si��wka��Story. I figured I could use that as an opportunity to tinker with those front-end technologies that I was so excited about.
But I was cautious. I didn’t want to use the latest exciting technology just for the sake of it. I was very aware of the gravity of the material I was dealing with. Documenting the story of G��si��wka was what mattered. Any front-end technologies I used had to be in support of that.
First of all, there was the typesetting. I don’t know about you, but I find choosing the right typefaces to be overwhelming. Despite all the great tips and techniques out there for choosing and pairing typefaces, I still find myself agonising over the choice���what if there’s a better choice that I’m missing?
In this case, because I wanted to use a variable font, I had a constraint that helped reduce the possibility space. I started to comb through v-fonts.com to find a suitable typeface���I was fairly sure I wanted a serious serif.
I had one other constraint. The font file had to include English, Polish, and German glyphs. That pretty much sealed the deal for Source Serif. That only has one variable axis���weight���but I decided that this could also be an interesting constraint: how much could I wrangle out of a single typeface just using various weights?
I ended up using font weights of 75, 250, 315, 325, 340, 350, 400, and 525. Most of them were for headings or one-off uses, with a font-weight of 315 for the body copy.
(And can I just say once again how impressed I am that the founding fathers of CSS were far-sighted enough to keep those font weight ranges free for future use?)
Getting the typography right posed an interesting challenge. This was a fairly long piece of writing, so it really needed to be readable without getting tiring. But at the same time, I didn’t want it to be exactly pleasant to read���that wouldn’t do the subject matter justice. I wanted the reader to feel the seriousness of the story they were reading, without being fatigued by its weight.
Colour and type went a long way to communicating that feeling. The grid sealed the deal.
The G��si��wka��Story is mostly one single column of text, so on the face of it, there isn’t much opportunity to go crazy with CSS Grid. But I realised I could use a grid to create a winding effect for the text. I had to be careful though: I didn’t want it to become uncomfortable to read. I wanted to create a slightly unsettling effect.
Every section element is turned into a seven-column grid container:
section {
display: grid;
grid-column-gap: 2em;
grid-template-columns: 2em repeat(5, 1fr) 2em;
}
The first and last columns are the same width as the gutters (2em), effectively creating “outer” gutters for the grid. Each paragraph within the section takes up six of the seven columns. I use nth-of-type to alternate which six columns are used (the first six or the last six). That creates the staggered indendation:
section > p {
grid-column: 1/7;
}
section > p:nth-of-type(even) {
grid-column: 2/8;
}
That might seem like overkill just to indent every second paragraph by 4em, but I then used the same grid dimensions to layout figure elements with images and captions.
section > figure {
display: grid;
grid-column-gap: 2em;
grid-template-columns: 2em repeat(5, 1fr) 2em;
}
Then I can lay out differently proportioned images across different ranges of the grid:
section > figure.landscape > img {
grid-column: 1/5;
}
section > figure.landscape > figcaption {
grid-column: 5/8;
}
section > figure.portrait > img {
grid-column: 1/4;
}
section > figure.portrait > figcaption {
grid-column: 4/8;
}
Because they’re positioned on the same grid as the paragraphs, everything lines up nicely (and yes, if subgrid existed, I wouldn’t have to redeclare the grid dimensions for the figures).
Finally, I wanted to make sure that the whole thing could be read offline. After all, once you’ve visited the URL once, there’s really no reason to make any more requests to the server. Static documents���and books���are the perfect candidates for an “offline first” approach: always look in the cache, and only go to the network as a last resort.
In this case I used a variation of my minimal viable service worker script, and the result is a very short set of instructions. There’s a little bit of pre-caching going on: I grab the variable font and the HTML page itself (which includes the CSS inlined).
So there you have it: variable fonts, CSS grid, and service workers: three exciting front-end technologies, all of which can be applied as progressive enhancements on top of the core content.
Once again, I find that it’s personal projects that offer the most opportunities to try out new or interesting techniques. And The G��si��wka��Story is a very personal project indeed.
June 17, 2018
Praise for Going Offline
I���m very, very happy to see that my new book Going Offline is proving to be accessible and unintimidating to a wide audience���that was very much my goal when writing it.
People have been saying nice things on their blogs, which is very gratifying. It���s even more gratifying to see people use the knowledge gained from reading the book to turn those blogs into progressive web apps!
It doesn���t matter if you���re a designer, a junior developer or an experienced engineer ��� this book is perfect for anyone who wants to learn about Service Workers and take their Web application to a whole new level.
I highly recommend it. I read the book over the course of two days, but it can easily be read in half a day. And as someone who rarely ever reads a book cover to cover (I tend to quit halfway through most books), this says a lot about how good it is.
I was delighted to discover a straightforward, very approachable reference on designing a ServiceWorker-backed application:��Going Offline��by��Jeremy Keith. The book is��short��(I���m busy),��direct��(���Here���s a problem, here���s how to solve it���),��opinionated��in the best way (landmine-avoiding ���Do this���), and��humorous��without being confusing. As anyone who has received unsolicited (or solicited) feedback from me about their book knows, I���m an��extremely��picky reader, and I have no significant complaints on this one. Highly recommended.
If you���re interested in the ���offline first��� movement or want to learn more about Service Workers, Going Offline by Jeremy Keith is a really gentle and highly accessible introduction to the topic.
Jeremy nails it again with this beginner-friendly introduction to Service Workers and Progressive Web Apps.
Jeremy���s technical writing is as superb as always. Similar to his��first book for A Book Apart, which cleared up all my confusions about��HTML5,��Going Offline��helps me put the pieces of the service workers��� puzzle together.
People have been saying nice things on Twitter too���
It���s a fantastic read and a simple primer for getting Service Workers up and running on your site.
Of course, if you���re looking to take your website offline, you should read @adactio���s wonderful book
Ok, I���m done reading @adactio���s Going Offline book and as my wife would say, it���s the bomb dot com.
If that all sounds good to you, get yourself a copy of Going Offline in paperbook, or ebook (or both).
Jeremy Keith's Blog
- Jeremy Keith's profile
- 55 followers
