Smashing Book 5: Real-Life Responsive Web Design
Smashing Book 5: Real-Life Responsive Web Design
Smashing Book 5: Real-Life Responsive Web Design
Real-Life
Responsive
Web Design
Published 2015 by Smashing Magazine GmbH, Freiburg, Germany.
Printed in the EU. ISBN: 978-3-945749-21-0
The book has been written and reviewed by Andrew Clarke, Ben Callahan,
Bram Stein, Chris Coyier, Dan Mall, Dmitry Baranovskiy, Eileen Webb, Emily
Gray, Fabio Carneiro, Jake Archibald, James Williamson, John Allsopp, Lisa
Maria Martin, Marko Dugonjić, Matt Gaunt, Patrick Hamann, Sara Soueidan,
Tom Maslen, Viljami Salminen, Vitaly Friedman, Yoav Weiss, Zach Leather-
man and Zoe Mickley Gillenwater.
TABLE OF CONTENTS
R
ESPONSIVE DESIGN HASN’T MADE THINGS EASIER, has it? The flour-
ishing diversity of web landscape — from form factors to connection
types to input modes to browsers — has only amplified the unpre-
dictability of user experiences on the web. This unpredictability is remarkably
difficult to tackle unless you embrace the inherent fluidity of the web as a
guiding principle in your work. In many cases, going responsive seems like the
most reasonable strategy for covering the entire spectrum of user experiences,
ranging from tiny viewports to ultra-wide HD screens, with a wonderfully con-
venient, and often deceptively sneaky one-codebase-for-everything approach.
We’ve learned by now that responsive design is much more than that.
Responsive design affects everything and everybody in the design process, and
in practice, a few media queries, fluid grids and flexible images aren’t enough.
Screen considerations alone aren’t enough either. We have to entirely rethink
and relearn our design practices, tools and processes; we have to adapt new
technologies and break down complexity of UI components; we also have to
deal with performance issues and hostile rendering environments and apply
content choreography to keep priorities and structure intact.
9
FOREWORD Responsive Way Forward
10
By Vitaly Friedman CHAPTER 2
RESPONSIVE DESIGN
PATTERNS AND COMPONENTS
W
E’VE ALL BEEN THERE: RESPONSIVE DESIGN IS MANAGEABLE, but it
isn’t straightforward; its premise shines through once it’s designed
and built, but throughout the process it poses hidden challenges
and stumbling blocks. Consequently, the workflow often feels remarkably slow
and painful. In fact, responsive design prompts us to reshape our mindset and
refine our practices, but also to explore new interaction patterns across a wide
variety of screens, input modes and connection types. However, we don’t have
to reinvent the wheel every single time we stumble on a design problem. That’s
what good ol’ design patterns — essentially common techniques for tackling
common issues — are pretty useful for.
Yet just as design patterns can be helpful and convenient, they can also be
misleading, driving us to generic and soulless designs, mostly because we often
lack context when applying them. More often than not, we don’t know the
rationale or the objectives, the failures, usability tests, the impact on conversion
rates and all the decisions made along the way, so we have to make our decisions
merely trusting other decisions in other, possibly unrelated contexts.
49
CHAPTER 2 Responsive Design Patterns and Components
50
By Vitaly Friedman CHAPTER 2
Design process is tricky and unpredictable. It’s not a continuous process with successive iterations,
but rather hitting and overcoming dead ends over and over again. Image credit: Julie Zhuo.1
Over the last few years, I’ve been spending quite some time in small and large
companies, solving responsive design problems, primarily related to UX and
front-end performance. I’ve seen a number of design solutions emerging, evolv-
ing and flourishing, and others getting shot down in merciless user interviews
or performance audits. I rarely found unique and obscure solutions suddenly
coming out of thin air, though; more often they were built on top of already ex-
isting (and seemingly established) design patterns, supported and informed by
trial and error, and fine-tuned by permanent, ongoing design iterations. Ideas
don’t come out of nowhere, they are built on top of others; I believe this holds
true for design patterns as well.
What does this mean for a design process? Well, I’d argue that it’s perfectly
fine to choose design patterns wisely and build your own on top of them. When
coming into a company to work on a project, our team can’t afford losing time
because we have just a week or two to produce meaningful results, mostly func-
tional prototypes. We can’t spend too much time on high fidelity mock-ups or on
complex custom cross-browser components which might take weeks of devel-
opment. To stay efficient, we can’t spend a lot of time on high fidelity in the pro-
totyping stage. In most cases, we have to be pragmatic, efficient and selective;
to achieve that, we explore design patterns and test them against reality with
actual users — early, quickly and often. Rinse, iterate, repeat.
1 https://medium.com/the-year-of-the-looking-glass/junior-designers-vs-senior-designers-fbe483d3b51e
51
CHAPTER 2 Responsive Design Patterns and Components
2 http://smashed.by/elements
52
By Vitaly Friedman CHAPTER 2
That’s exactly what this chapter is about: clever design solutions, obscure
techniques and smart strategies that I’ve seen working or failing in actual
projects, and which could be applied to your projects, too. You might not be
able to use all of them, but hopefully you’ll get a good enough idea of just what
kinds of solution might work well in common situations when designing or
building responsive websites. Let’s start. Fasten your seat belts. It’s going to be
quite a journey.
Navigation Patterns
Surprisingly, making navigation work well across a large variety of devices
often proves to be one of the most challenging and involved undertakings in
responsive design. And it’s often not just a matter of organizing all existing
content but rather reducing existing complexity and setting priorities well.
53
CHAPTER 2 Responsive Design Patterns and Components
In a narrow view, WWF reduces the entire navigation to three critical items: two calls to action and a
navigation icon, leading to primary navigation.
54
By Vitaly Friedman CHAPTER 2
options at once; for mobile, prioritization is both crucial and necessary to avoid a
cluttered and inefficient interface.
On KiwiBank, all content is consistently available everywhere, but priorities change depending on the
viewport. That’s a risky undertaking, but it could be worth testing at times.
4 http://www.kiwibank.co.nz/
55
CHAPTER 2 Responsive Design Patterns and Components
StarWars.com probably has the most unusual “hamburger” navigation, with three horizontal lines
turning into lightsaber on click — and a navigation drawer sliding in from the left side.
56
By Vitaly Friedman CHAPTER 2
You know how it works: in a narrow view, users might see a few main
navigation options (such as Search, Cart or Menu buttons), but they don’t see all
available navigation options right away. These options are revealed via a naviga-
tion drawer on click or tap on Menu, sliding in from the left, the right, the top or
sometimes sliding in between the logo and the main content area. What sounds
like a pretty much established and widely accepted paradigm doesn’t necessar-
ily work flawlessly in every context. We noticed that navigation items hidden
behind an icon almost certainly result in a (much) lower engagement ratio when
compared with links displayed on the page — and consequently produce fewer
clicks. Besides, if critical items of your interface (such as a shopping cart or
login) are hidden off-canvas, users can get impatient and frustrated. Such nav-
igation items would be better off displayed on the page, perhaps with a notice-
able icon, in a tab, as a button or as a simple link.
It’s not just about engagement, though. We’ve also noticed that when using
the off-canvas pattern we always ended up with an uncomfortable viewport
range between the standalone hamburger icon on very narrow views and a fully
fledged navigation menu on larger views. The problem: when exactly do you
start displaying full navigation? Or, the other way around, when exactly do you
start hiding full navigation behind an icon? And what exactly should happen
on screens which are neither narrow nor particularly wide? Well, usually it’s
dismissed as an edge case, so navigation items are displayed only if they fit
entirely on one line, although we might have enough space to show something
usable. That’s suboptimal at best.
And then, of course, the issue of internationalization comes along: what if,
on top of the existing uncomfortable viewport range, you need to accommo-
date navigation for a dozen languages? To keep your codebase maintainable in
the long term, you can’t keep creating media queries based on every supported
language (e.g. by adding classes on the <body> element); you’d have to create a
mess of additional classes, or even style sheets that would need to be revisited
once the navigation changes dramatically.
57
CHAPTER 2 Responsive Design Patterns and Components
The uncomfortable range. All navigation items could potentially be displayed on narrow views, but instead,
they are hiding behind the infamous icon.
Of course, you could solve some of these issues with iconography, but icons
aren’t always universally understood and often it’s just not an option: what icon
would you choose to display “Our philosophy” or “Delivery times”? Not surpris-
ing, then, that in many scenarios the off-canvas pattern seems like the simplest
and safest strategy to keep navigation options out of the way, yet still accessible
and unobtrusive, so the navigation won’t break or pollute an existing layout,
independent of the languages you choose to support in the future.
Another thing we noticed is that, when implemented without a thorough
content inventory, the off-canvas drawer might end up containing many unnec-
essary secondary items and many nested levels of navigation. Sometimes it’s
5 https://github.com/aaronbarker/makefit
58
By Vitaly Friedman CHAPTER 2
required and expected, but more often it isn’t. Therefore, when we start working
on a project, we always look into options of focusing on primary navigation
alone. If search is provided, we explore what happens if we remove secondary
navigation altogether, both on desktop and on mobile, and how user experience
deteriorates as a result. If the result is suboptimal, we add one level of navi-
gation and measure again. If we still notice a UX problem, we keep repeating
the process. And if there is a lot of content to organize, sometimes we look into
providing something like a step-by-step guide from general to specific naviga-
tion items, very much like the GOV.UK homepage. When required, different
nested levels in mega drop-downs could be accommodated via accordions,
although they might not be absolutely necessary if search provides autocom-
plete or uses the type-ahead pattern.
On gov.uk, different levels of navigation are displayed as layers, so all sections are available right away,
with one click.
59
CHAPTER 2 Responsive Design Patterns and Components
“
This ability to scan these labels left-to-right and feed right into the overflow
‘more’ link feels like a more natural discovery flow compared to everything
hiding beneath an ambiguous icon.”
You could even go as far as displaying navigation options next to the logo,
not using any additional vertical space for navigation at all. In that case,
making your logo responsive — delivering different logo variants to dif-
ferent views — would be helpful as well, either via an SVG sprite or media
queries within SVG to adjust some elements in the design. Obviously, it
depends on the complexity of the logo, but using responsive iconography
to save precious vertical space on the screen for content could be worth
considering for icons with a high level of detail.
The Guardian and Google Docs are good examples of the pattern in action.
In every view, users see something: a few navigation items which hopefully are
sorted according to their usage and priority. Because you prioritize important
items, critical actions will always be reachable and visible, potentially driving
more direct traffic to those important sections or features of the site. This could
be particularly useful for cases with a large amount of heavily used navigation
sections, such as an online shop which accommodates a mega drop-down in
large views.
6 http://bradfrost.com/blog/post/revisiting-the-priority-pattern/
60
By Vitaly Friedman CHAPTER 2
The Guardian shows as many items as possible in a horizontal bar, prioritized based on what’s most
popular, and the rest is accessible in the “all” menu.
However, it’s not always clear what navigation icon to choose for a given
scenario. In a few projects targeting elderly users, we found that the hamburger
icon wasn’t widely understood and sometimes led to confusion. You could argue
that it’s just a matter of time until the hamburger icon becomes accepted, but
it’s a safe bet to avoid any iconography altogether and use a clear label (“Menu”)
with a clear affordance as a button just like Luke Wroblewski recommends7.
Historically, we used to place the icon in the upper corners of the screen,
but larger screens made it difficult (if not impossible) to reach those interface
controls with a thumb alone, which is a preferred mode of use by a large
majority of users; it might be a good idea to place them as tabs at the bottom of
the screen instead, or as a floating navigation icon in the bottom-right corner.
The transparency of the icon could increase as the user keeps scrolling
down the page, making it noticeable but unobtrusive, and still providing
options on tap. Obviously, you wouldn’t want to embark on a hideous
journey of bug fixing, but there are some workarounds,
e.g. position:sticky polyfill8.
7 https://twitter.com/lukew/status/443440251042676737
8 https://github.com/filamentgroup/fixed-sticky
61
CHAPTER 2 Responsive Design Patterns and Components
If we do use the off-canvas pattern, we always tend to cover three critical use
cases. First, when users tap on an icon or button to open the navigation drawer,
they shouldn’t have to move their mouse or finger to close it again; the interface
should display the button to close the navigation in exactly the same spot where
it initially displayed the menu button. We found out that just as visitors use
navigation to jump to the specific content they need, sometimes they want to
explore available options without jumping deep into specific areas of the site.
9 https://medium.com/
62
By Vitaly Friedman CHAPTER 2
removes the entire navigation when a user starts to scroll down and reveals it
again once a user scrolls back up. This technique might work for overviews of
products as well as long reads, although we’ve never had a chance to test it in an
actual project.
If you have many navigation options, you could use vertical media queries to show fewer items if there
isn’t enough space to show them all.
10 http://www.uxmatters.com/mt/archives/2013/02/how-do-users-really-hold-mobile-devices.php
63
CHAPTER 2 Responsive Design Patterns and Components
A good example for vertical media queries would be a layout in which open
navigation options cover a significant portion of the content. In such cases, you
could reduce the number of displayed items (again, very much like the Priority+
pattern suggests, vertically) and add a toggle to switch to the remaining items if
there isn’t enough vertical space to show them all at once (see Southwest Airlines
example above). Another use case would be a vertical full-height navigation
where you might want to adjust the blocks of content to fit the entire content
on the screen. Also, paddings, margins, font sizes and icons could be adjusted
to tame the content within the screen. If you have a drop-down which appears
in the middle of the page, you could review the amount of space available in
the browser window under the drop-down, and potentially display navigation
options above the drop-down when there isn’t enough space beneath it.
You could also detect device orientation and adjust interface controls
to better match more comfortable hit areas, pulling them to the left and
right in the landscape view, and to the bottom of the screen in the portrait
mode. This way, interacting with the UI might be a bit more convenient.
11 http://www.wikipedia.org/
64
By Vitaly Friedman CHAPTER 2
A wireframe of an e-commerce page with a few filters. In a narrow view, users would see exactly zero
content, even with selected filters. Image credit: Daniel Wiklund,
https://medium.com/@danielwi/view-mode-approach-to-responsive-web-design-914c7d3795fb
65
CHAPTER 2 Responsive Design Patterns and Components
The simplest strategy would be to break down the single, large filters
section into multiple detached, smaller sections. We then could show them at
the bottom of the screen as three to four separate tabs instead of just one large
block in the header of the page. Each of the tabs would need to have a clear label
(e.g. “Color”, “Size”, “Price range”), and once tapped or clicked, reveal appropri-
ate filters. Another option would be to have the filters float on the side as users
explore the products they have filtered. A slightly more interesting option would
be to hide the filters behind an icon in the upper-right corner and display them
on tap or click as a persistent layer. This layer would cover a part of the screen
(on narrow views, obviously, the less screen it covers, the better), while the
content would appear in a semitransparent layer beneath the filters layer. So if
users have relatively wide screens, they’ll see both the filters and the content.
That’s also the reason why the layer is persistent: if users choose to close the
filters section, they must have made up their minds, so (almost) the entire screen
will be dedicated to the content and not filters; otherwise they might need to
repeatedly open and close the filter drawer.
With encapsulated views, we can show both the content and the navigation — as far as possible. In nar-
row views, we could use a persistent layer covering a part of the screen on the right, and on larger views,
the filters could appear on the right side as well, for consistency. Image credit: Daniel Wiklund,
https://medium.com/@danielwi/view-mode-approach-to-responsive-web-design-914c7d3795fb
66
By Vitaly Friedman CHAPTER 2
12 http://www.cancer.dk
67
CHAPTER 2 Responsive Design Patterns and Components
View mode pattern used on Cancer.dk to reveal navigation options while showing content on the
left side. When users browse through navigation options, the content area is updated automatically.
right) and see the content of the selected section (on the left) at the same time.
In fact, the pattern passed usability studies with flying colors, and it’s still being
used now almost a year later.
68
By Vitaly Friedman CHAPTER 2
is figuring out the right time and place to display an action” (“Conversions@
Google 2014”)13 — displaying a call-to-action button very early at the top of the
page is often neither the right time nor place to encourage that action.
Crazy Egg’s14 recent redesign showed that short, concise landing pages don’t
necessarily result in higher conversion rates when compared with longer pages.
In the redesign, the challenger design was 20 times longer than the control but
caused a 30% increase in conversion15, simply because the design team added
testimonials and feature highlights that made a convincing argument at the
right time and the right place. Again, to quote Luke from the same talk, “the issue
wasn’t whether the call to action was visible, but rather whether the call to action was
visible at the point when someone has become convinced to take action.”
Perhaps “above the fold” isn’t the most lucrative area anymore — just above and just below the fold are.
But how do you identify this point? Well, you rely on research. According to a
recent Chartbeat study, “Scroll behavior across the web16” by Josh Schwartz, the very
first thing many people do when they encounter a website is scroll down. This is
primarily because they can often find the logo, navigation, search field and ads
at the very top of the page, occasionally accompanied by a window encouraging
69
CHAPTER 2 Responsive Design Patterns and Components
users to download an app — often there is just no useful content at the top of the
page. In fact, some users start to scroll down a page before it finishes loading.
The most viewed area of the page is just above the fold, at about 550px,
with just over 80% viewership. The area between 750px and 1,500px is viewed
nearly three times as long as the top portion of the page, with the peak at 750px
seen by over 80% of visitors for an average of 13 seconds. This is where most
people spend most of their time and where a call-to-action button would be best
placed, provided that the work of convincing the user has already been done.
Another myth surrounding many conversations in the war room (also called
“the meeting room”) are the benefits of carousels. Clients love them, but the
verdict of the design community is pretty clear: carousels don’t convert. The
images aren’t seen nearly as often as they should be, not to mention perfor-
mance issues; hence, they should be avoided at all costs.
To be honest, it’s not surprising most carousels aren’t efficient — all too
often they are poorly designed. They are nothing more than an oversized image,
with a few hardly noticeable dots (supposed progress indicators) and, if you are
lucky, arrows on the side; or, if you are unlucky, automatically rotated images.
However, carousels rarely give users any incentive to navigate to the next item,
and once they choose to do so, the controls prove to be very difficult to use.
Carousels aren’t necessarily dead. Poorly designed carousels are highly inefficient. Well-designed
carousels could be efficient: there must be a clear incentive for users to flip it through. Belavia.by and
Amazon.de in comparison.
70
By Vitaly Friedman CHAPTER 2
17 http://choiseul.info/
71
CHAPTER 2 Responsive Design Patterns and Components
On narrow viewports, the Kremlin site shows either the content or the navigation.
18 http://kremlin.ru/
72
By Vitaly Friedman CHAPTER 2
If there is enough screen to fit multiple pieces of content at the same time (e.g. both the search results
page and the actual search result), you could show both at the same time.
This pattern could be applied in other scenarios as well; for example, if you
have a gallery in your article or product page, in larger views the images could
float to the right, next to the article; or slide into designated areas in narrow
views. The same goes for comments, surveys, and any other supporting content.
73
CHAPTER 2 Responsive Design Patterns and Components
SwissAir.ch provides many interesting subtle examples of a smart responsive design. One of them is a
flight selection table, changing orientation from horizontal to vertical between large and narrow views.
well for small tables, but becomes unwieldy for more complex tables, creating
long, potentially annoying pages which are difficult to scan. We already know
what works well in most scenarios, though: accordions! To keep the <datalist>
shorter and more compact,
you could turn single blocks of
content into a series of accordi-
ons and reveal content on tap or
on click.
Certain tables call for
specific and sometimes creative
solutions. For instance, if
you’re designing a table to
allow users to select a flight,
with outgoing flight options
lined up horizontally, and
return flight options lined up
vertically, you might end up Sometimes you might want to tilt headings a little bit
to regain horizontal space by sacrificing some vertical
with a table in which every cell space. It really depends on the nature of the table.
contains a radio button. While Credit: http://codepen.io/anon/pen/WbzbbQ
74
By Vitaly Friedman CHAPTER 2
A tournament table isn’t easy to design: SBNation.com went for turning a table into a slider, although
a set of accordions with a more condensed view might work just as well.
Think about the specific properties and structure of a table before settling on
a solution. You might discover similar table issues when designing any kind of
survey, or selecting tickets for a performance (with dates presented as columns,
shows presented as rows), or any other experiences where multiple selection is
in place.
75
CHAPTER 2 Responsive Design Patterns and Components
Another option would be, again, to display some columns as cropped en-
capsulated views or layers, as mentioned earlier. That’s exactly what SwissAir’s
website19 does. If one of the table columns is particularly important, you could
also keep it fixed while making the other columns scrollable, so when users start
reading the table, they always have a clear association between the content that
they read and the row where it belongs.
If the data in your table is mostly numerical, you could visualize it as a graph
or chart in both narrow and desktop views, and provide a link to a full table view
for users who wish to see the tabular data instead (as well as a “graph” view for
users wishing to see a chart on desktop views).
These solutions work well but they aren’t always applicable. Content can
be incoherent, data relationships could be strict and the table might not have
any consistent structure. In these cases, displaying tabular data in fragments
— again, reducing the complexity of the component — can work remark-
ably well. The idea is simple: since we can’t make any assumptions about the
columns or rows that users would or would not like to see, we could allow them
to select columns of interest while at the same time providing an option to show
all columns as well.
19 http://www.swissair.com/
76
By Vitaly Friedman CHAPTER 2
77
CHAPTER 2 Responsive Design Patterns and Components
the next three columns first, revealing subsequent columns on click or tap, and so
on. For a narrower viewport, you could reveal two columns in each step, with the
headings column remaining static. Additionally, an indicator could present how
many items are currently in view, very much like we do in carousels.
These last solutions often seem more appropriate for tables than just
turning tabular data into a <datalist>, unless the nature of the table requires all
columns to be present at all times. In an overview of pricing options, insurance
plans or a car comparison, different columns and rows might have different
weight for users, so allowing them to select columns or rows of interest could
work well. But when it comes to flight selection, seat selection in a theater or
checkout in an online shop, the integrity of a table is vital. There, a <datalist>
(potentially with an integrated accordion if there is a lot of data to show) might
be a more appropriate solution.
20 https://github.com/filamentgroup/tablesaw
78
By Vitaly Friedman CHAPTER 2
In this and similar scenarios, we should take a step back and look into
options of reducing the fidelity and complexity of the initially displayed content.
Do we need all icons in the calendar? Do we provide any meta information
that could be displayed separately? Can we use ellipses to shorten the amount
of text? What else can we remove to keep the calendar focused and retain its
integrity on narrow views as well?
That’s the exercise we run through as a team every time we encounter
not only calendars, but pretty much any complex component that can’t be
modified easily without compromising user experience. By simplifying content
fragments within the component, we can always break down its complexity and
focus on the core content it contains.
Ultimately, there is always the
option of pulling the content out
of the component, identifying
and grouping content fragments
logically, and presenting them
as separate encapsulated views
within a few subsequent sections
on a page. For a calendar, you
could choose to pull highlight-
ed items and present them in a
smaller, focused tabular view in
narrow viewports, while all the
other items could be displayed
You could also integrate a mini map and combine it
in a <datalist> underneath the with a selection of columns the user wants to see.
table. If you need to design a city https://github.com/filamentgroup/tablesaw
map with numbered markers
within the map and detailed hints about specific locations displayed on tap or
hover, you could reduce the fidelity of a map in narrow views, and pull out the
content beneath the map as a <datalist>.
What if you are designing a platform for selling tickets to any kinds of event,
be they concerts, baseball games or cinema screenings? You’d like venue owners
to submit a seating map for their venue to you, along with an overview of the
79
CHAPTER 2 Responsive Design Patterns and Components
A calendar doesn’t have to look like a calendar across all screens. You could use the content from a calendar
and display it in two separate views on narrow screens, like Muse (http://objectivelogistics.com) does.
most expensive and most affordable areas, so buyers can visit your site and
purchase a ticket to the show. Visitors should be able to select an area where
they want to sit, but beyond that they should be able to zoom in to the area of
interest and select both the row and, once zoomed in again, the actual seat they’d
like. Obviously, the entire interface should be fully responsive, too.
One way of solving this would be to introduce what is known as the assistant
pattern — complexity is reduced by asking users to set some preferences
first (the pricing range or the seating area, for example) to lower the level of
detail required on the map and remove markers that aren’t useful. We then get a
more manageable map, perhaps with slightly larger dots to comfortably accom-
modate 44×44px hit areas. Underneath the map we could provide an overview
of options listed either by seating area or price — adjustable by users. When
users choose to explore an option, they are zoomed in to the area of interest and
receive further details about the seating in the information area beneath the
map. Moving back through the list of options would zoom out the map view.
Alternatively, you could also use a slider to enable visitors to define precisely the
level of detail they’d like to see.
80
By Vitaly Friedman CHAPTER 2
This experience could translate to both narrow and wide views, and we could
take advantage of available space to display a more detailed map in larger views.
Again, the strategy of breaking down complexity and creating a few smaller and
more manageable content fragments could go a long way in pretty much every
responsive design issue you’ll encounter.
ADJUSTING MICRO-COMPONENTS
Breaking down complexity isn’t always necessary. Components can be relatively
simple with pretty straightforward ways to make them work for the whole range
of screens — if you have the right idea of how to adjust their design and behavior.
Progress Steps
For example, think
about the progress
steps or breadcrumbs
in a checkout. If a
checkout takes four
or five steps in total to
complete, displaying
the entire user path
through these steps
would require way too
much vertical space
in narrow viewports.
Instead, we could use Hrvatski Telekom (https://hrvatskitelekom.hr ) shows a fully fledged
breadcrumbs navigation in large views and turns them into plain text in
the content property
narrow views. Image credit: Marko Dugonjić.
with a pseudo-class
in CSS to display the
current step as plain text, with arrows pointing to the previous and next steps
(see Hrvatski Telekom screenshot for comparison). A very simple adjustment that
doesn’t require a lot of work, but produces a perfectly sensible result.
81
CHAPTER 2 Responsive Design Patterns and Components
Timelines
For timelines — either horizontal or vertical — marking important milestones or
dates on either side, an almost natural solution would be to flip the timeline to a
vertical view and perhaps display the content for each milestone via a toggle.
21 https://gionkunz.github.io/chartist-js/
22 http://www.informed-design.com/responsive/chart/
82
By Vitaly Friedman CHAPTER 2
Maps
If your chart accompanies a map and you use polygons on the map for user
input, sometimes the map’s fidelity can’t be reduced without making inter-
action inconvenient for users. For example, an SVG map of the United States,
every state a polygon, could allow users to click or tap on polygons to select a
state (perhaps as a filter for specific items related to that state); but the further
the map is scaled down, the more difficult it becomes
to select a state. A bulletproof solution would be to use
a simple drop-down in a narrow view, with progressive
enhancements up to a fully interactive map when the
space allows for it.
The solution isn’t as straightforward, though, when
you need to display a large preview of the entire map and
not only a cropped region of it. First of all, we could use
Thierry Koblentz’s padding-bottom hack23 to create a fluid
map that preserves aspect ratio24 to keep the focal point of
the map centered25.
In usability studies, we noticed
that embedding Google Maps or
any kind of iframe often leads to
confusion: when users decide to
scroll down a page, they get dragged
into the map and find themselves
scrolling the iframe instead. The
only way out is to tap an area outside
the iframe and keep scrolling there;
but if the iframe could take up a lot
Travois uses progressive enhancement to turn a simple,
of vertical space, and so getting out accessible drop-down into an interactive SVG map for
of it can be painfully difficult. larger views. http://travois.com/projects/
23 http://alistapart.com/article/creating-intrinsic-ratios-for-video
24 http://daverupert.com/2012/04/uncle-daves-ol-padded-box/
25 http://codepen.io/bradfrost/pen/vwInb
83
CHAPTER 2 Responsive Design Patterns and Components
In such cases, you can use two workarounds to improve user experience.
First, for every map embedded in your site, you can create a semi-transparent
<div> overlay that would cover up the entire map, like a layer of ice covering a
river on cold winter nights (poetic, right?). When users scroll down through the
page, they will slide over the empty <div>. If they do decide to access the actual
map, they need to click or tap the map first, so the <div> will be removed from
the DOM via JavaScript. Users without JavaScript support would receive a link
to the Google Map page via <noscript>.
A slightly better pattern to achieve almost the same experience is exhibited
by adaptive maps26, where we load a basic text link to Google Maps by default
and additionally load either a static map image for small screens (preview) or a
full iframe map for larger screens — preferably conditionally, so we don’t have a
performance overhead in either case.
Lightboxes
The same adaptive logic could also be applied to lightboxes which so often break
user flow on narrow views. Quite a few websites simply squish a lightbox as
a fullscreen overlay, with heavy lightbox scripts and tiny interface controls.
However, this behavior goes against the logic of why lightboxes exist in the first
place. As Jordan Moore so eloquently wrote27: “the purpose of a lightbox is to
display a larger image corresponding to the selected thumbnail version while
keeping the user on the same page instead of linking directly to a page showing
the full image. […] In fact you may argue that a lightbox shouldn’t even exist on
small displays”.
Which hits the nail on the head. But if a lightbox shouldn’t exist on small
displays, how do we deal with it? Actions that happen in a lightbox on large
views are often best handled as separate pages on smaller screens28, so if you
have an interaction that requires user input, dedicating an entire page to it in
narrow views might be a good idea.
26 http://bradfrost.com/blog/post/adaptive-maps/
27 http://www.jordanm.co.uk/post/26207088124/pattern-translations
28 http://www.lukew.com/ff/entry.asp?1390
84
By Vitaly Friedman CHAPTER 2
When your lightboxes contain only photos (a product gallery, for instance),
you could present them within a swipeable area in narrow views, or you could
simply link to the image file directly by default. Opening an image “allows the
user to pinch and zoom to read what could otherwise be entirely illegible.29”
Then you could detect the screen size and decide whether to load a lightbox
script or not, and if the screen is large enough to accommodate the lightbox,
inject the script on the fly. Again, no performance overhead and a better expe-
rience for everyone.
29 http://bradfrost.com/blog/post/conditional-lightbox/
30 http://www.bigfootjs.com/
85
CHAPTER 2 Responsive Design Patterns and Components
of space available), should update its location as the viewport changes size, and
should never scroll offscreen. You could apply this technique to sidenotes as
well: just turn them into inline footnotes at the end of every paragraph, with a
different CSS styling to keep them distinguishable, and display them fully on
click or tap.
PDF
Yes, you read it correctly: PDF. We spend a lot of time talking about removing
all render-blocking resources from the critical rendering path, but I believe we
don’t spend enough time discussing how to deal with good old-fashioned PDFs.
PDFs are often very heavy in file
size, sometimes uncompressed,
and difficult to read on a mobile
screen. If your users happen to be
on a slow connection, the chanc-
es are high that they won’t even
bother downloading a PDF file
because they won’t be able to read
anything from it until it’s been
completely downloaded — unless
the PDF is opened in a smart
browser with an integrated PDF
viewer. But what if a user knows
Instead of providing only a link to PDF, we could generate
that the content she needs is on thumbnail preview for all pages and make them available
page 17? There is no way of access- to users additionally to the PDF view.
ing it before the first 16 pages have
been downloaded and rendered.
Now, we could generate different versions of the PDF for different views and
serve them conditionally to different screens, but it’s inconvenient and involves
unnecessary work. Instead, we could generate a (relatively) large thumbnail
version of each PDF page, save it highly compressed and provide an overview of
all pages to the user, as well as a PDF file. If users want to jump to page 17, they
86
By Vitaly Friedman CHAPTER 2
can do it via a thumbnail view. The image received will not look particularly im-
pressive, but it will load fast and it will contain the information users need. And
if they decide to download the PDF file after all, that option is always available.
This is exactly what Energy Made Clear31 does, and it does it very well indeed.
Interaction music notation, with chords and tablature adjusting depending on the screen size. With a bit
of SVG, <canvas>, JavaScript and media queries.
Well, you start exploring. In such rare cases, you would need to figure out
how to create custom responsive elements, perhaps with SVG or in <canvas>,
and then decide how the content should be adjusted to be properly displayed at
different screen resolutions. The front-end engineers behind Soundslice32 had
exactly this problem, and the way they solved it was by introducing adaptive
31 http://www.energymadeclear.com/
32 https://www.soundslice.com/
87
CHAPTER 2 Responsive Design Patterns and Components
notation in which the displayed size and thickness of chords and pauses is recal-
culated and redrawn in <canvas> when a window is resized. I’d argue that if you
can make sheet music responsive, you can make pretty much anything respon-
sive, wouldn’t you agree?
It’s not just the culture that demands a lot of visual language in Asian
countries. Because web fonts would need to support thousands of
glyphs, loading them just isn’t viable, so text is embedded into images;
and because mobile is dominating Asia, text has to be perfectly readable
on narrow screens, so different versions of images are sent to different
screens. Owing to this, Asian websites are almost inherently prepared
for the art direction use case: there is just no way around it. Not
surprising then that it’s an interesting space to explore design patterns
for dealing with visuals.
88
By Vitaly Friedman CHAPTER 2
Complex visual layouts on large screens can translate to slightly different layouts on narrow
screens; often a list of navigation options works well, and so does a slider — but controls to
move between content blocks could be helpful. Sapporo and Typekit websites as examples.
Two patterns often work well in such scenarios: you could either turn each
illustrated section into a full-width block and arrange all sections vertically in
one column (see Support Sapporo33 above); or arrange all sections horizontally
and use a slider to navigate through the items with a swipe (see Typekit34).
33 http://support-sapporo.or.jp
34 https://typekit.com/
89
CHAPTER 2 Responsive Design Patterns and Components
In the first case, you could use accordions if the sections are content-heavy;
in the second case, it might be a good idea to ensure that a portion of the next
section is always displayed (the overflow pattern), or, even better, add toggles in
the top-right corner to let users easily navigate to the previous and next sections
without having to swipe very precisely.
35 http://davidecalignano.it/css-trick-to-reproduce-glimpse-on-native-scroll/
90
By Vitaly Friedman CHAPTER 2
with a finger on an input field — users should be able to stay on the keyboard
comfortably, without diverting their attention to anything else. Of course, the
should still be appropriately set, so when users decide to switch to the
next field via Tab on their keyboard, they
can; but moving between the input fields
might not necessarily require it.
36 http://www.swissair.com/
37 http://www.typeform.com/
91
CHAPTER 2 Responsive Design Patterns and Components
You could apply quite a few very subtle yet very handy tweaks in your form
design pretty quickly:
Not only the design of input elements matters, but also the choice of input
elements, too. In our projects, we tend to spend a lot of time thinking about
ways to remove input fields and drop-downs altogether and replace them with
slightly more comfortable input methods, such as sliders, toggles or reasonably
sized radio buttons.
92
By Vitaly Friedman CHAPTER 2
range would work better as a slider; the number of nights in a hotel, or any other
discrete numerical input, would be better off with a simple stepper control — to
increment a value, users can just keep tapping on a button instead of typing.
A flight’s class with only a few
options (first, business, economy)
could be presented as tabs —
segmented controls — with only
one tap required to provide input.
Special dietary requirements,
for example, or any on/off states
could be designed as a toggle.
Such details make up the entire
experience, so before we design
(or redesign) a form, the first thing
we do is conduct an interface
inventory of all the input elements
within the form. Chances are that Segmented control for a donation form: with a few
items provided, instead of a large drop down or input
the choice of input elements will field. Image credit: Brad Frost, http://bradfrost.com/
have to change significantly. blog/post/designing-an-effective-donate-form/
93
CHAPTER 2 Responsive Design Patterns and Components
Steppers adjust a specific value quickly and precisely; sliders can help adjust
a large set of values quickly, but not as precisely. Depending on the task, we can
use a single slider with just one value (say, a specific date in history), or a double
slider with a range of values (a min/max price range for a home). For predefined
values, such as clothing size, we could use discrete sliders with fixed values
that users can snap to easily; for
indeterminate values such as price or
temperature, we could use continuous
sliders which don’t have any fixed
values at all.
One caveat: if users can select any
A histogram slider on Airbnb provides some
range of their choice, they might end metadata about the number of available
up with empty results pages which apartments at a given price range.
94
By Vitaly Friedman CHAPTER 2
on common email providers, or automatically correct them. It’s also a good idea
to let new users verify their email address before sending a message via the
contact form, so they have a chance to correct it before sending the data, and you
won’t end up with incorrect or mistyped email addresses.
To tame a web form’s height, we
sometimes use input placeholders as
labels to indicate what kind of data
is required. However, if the input
is lengthy or users are interrupted,
they might lose the context of what
exactly they were supposed to type in.
That’s where the floating label pattern
is useful: the labels exist as placehold-
ers but when users start typing, the
labels float above the field in a slightly
smaller font size. It’s a nice way to
keep both the input and context in
place without losing too much space.
If you can’t move the label to the top
but a field is wide enough to accom-
modate it, you could float the label to
the right or left in the narrow view as
well.
Some sites insist users are over a
certain age to access the content. The
owners of these sites honestly don’t “Floating label” pattern in action: when users start typing
in data, input placeholders turn into labels and float
care about the actual day and month above the input field. Users see both: the label and their
and year when users were born, they input. Source: http://mds.is/float-label-pattern/
care mostly about the age. But most
visitors lie when challenged by this question, so why don’t we make it easier for
them to lie? Instead of asking for a specific date of birth, ask if the user was born
in “1990 or earlier”, or any relevant year, and use it as the input instead. It might
not be feasible in every country but it’s worth looking into. It also goes for credit
95
CHAPTER 2 Responsive Design Patterns and Components
96
By Vitaly Friedman CHAPTER 2
Conclusion
Phew, that was quite a journey but, frankly, this journey wasn’t particularly
comprehensive. There is a plethora of good, smart solutions to be discovered —
it’s just up to us to look for and find them. Explore foreign responsive websites,
because you’ll likely be confronted with unique interactions and patterns that
you haven’t encountered before. Chances are high that your problem has already
been solved.
In some circles, responsive design has a reputation for being difficult,
complex, tiring and inefficient. Well, it isn’t. It isn’t if you have a good team
around you, a good process in place, and a set of design patterns on which you
can build your solution every now and again.
I hope you’ve found a few gems in this chapter that you’ll be able to apply to
your project right away once you flip over this page. You will fail, and you will
start over, but you will eventually succeed and achieve better and smarter results
much faster than you used to.
97
CHAPTER 2 Responsive Design Patterns and Components
98