Intentionally dealing with responsive design

199
Responsive Design Intentionally Dealing with Joe Kendall and Erin Sparling, Dow Jones

description

 

Transcript of Intentionally dealing with responsive design

Page 1: Intentionally dealing with responsive design

Responsive DesignIntentionally Dealing with

Joe Kendall and Erin Sparling, Dow Jones

Page 2: Intentionally dealing with responsive design

4 hours is a lot of time to fillTimeline of the presentation

40 0.5 1 1.5 2 2.5 3 3.5

10

0

1

2

3

4

5

6

7

8

9

Time (in hours)

Leve

l of I

nter

est (

ove

r ti

me

)

LongWeekend

InterestingTopics

SnackTime

TechnicalDeep Dive

Page 3: Intentionally dealing with responsive design

An Introduction to the Dow Jones Design StudioPreamble

Page 4: Intentionally dealing with responsive design

Dow Jones Design StudioThe Design Studio is a multi-disciplinary team focused on the strategic design needs of the various media and publishing properties of Dow Jones.

Page 5: Intentionally dealing with responsive design

• WSJ, Barrons, NYPost iOS app templates

• WSJ Responsive Web

• MarketWatch Tablet App

• DJ Financial Services

Dow Jones Design Studio Properties• WSJ

• Barrons

• MarketWatch

• Factiva

• DJ Risk & Compliance

• WSJ Real Time

Page 6: Intentionally dealing with responsive design

Discussing Responsive Design

Designer / Developer

Unicorn

Page 7: Intentionally dealing with responsive design

Discussing Responsive DesignDesigner / Developer

Designer DeveloperStartup

Page 8: Intentionally dealing with responsive design

Designer Developer

Discussing Responsive DesignDesigner / Developer

Designer UX Front-end Back-end

EstablishedCompany

Page 9: Intentionally dealing with responsive design

Discussing Responsive DesignDesigner Developer

Designer UX Front-end Back-end

HTML/CSS JS Middleware Back-end / DBALarge Organization

Page 10: Intentionally dealing with responsive design

HTML/CSS JS Middleware Back-end / DBA

Discussing Responsive Design

Architect Engineer SA DBA

Back-endFront-end

InternationalConglomerate

Page 11: Intentionally dealing with responsive design

Internal DefinitionUser Experience Designer

Designer who focuses on user flows, documentation, rules and product research:

A user experience designer creates wireframes with designers and product managers.

Page 12: Intentionally dealing with responsive design

Internal DefinitionDesigner

Designer who focuses on mock-ups, brand definition, aesthetic guidelines:

A designer works with business leads to create a consistent visual approach to disparate products under a common brand.

Page 13: Intentionally dealing with responsive design

Internal DefinitionDesign Technologist

Technologist whose primary concerns are tangible interfaces:

A design tech creates html, css, javascript and development systems to enhance the design process.

That’s Us!

Page 14: Intentionally dealing with responsive design

Techniques of a Design Technologist• Good sense of design

• Focused on the user experience

• Knowledgable of middleware and back-end, but not focused on them

• Front-end trend conscious

• Systematic problem-solver and flag-waver

• Extremely verbose in communication

• Community outreach

Page 15: Intentionally dealing with responsive design

Our concerns and focusJavascript• We care about the friction coefficient of the

deceleration of a sliding navigation item

• We care about developing slight-of-hand tricks to increase performance, via both real and perceived metrics

• We do not care about systems to determine whether or not you have permission to view an article

• We do not care about building an a/b test suite, but we love using them

Page 16: Intentionally dealing with responsive design

Outreach

Page 17: Intentionally dealing with responsive design

The Way We WorkOur landscape for Development, Integration & Deployment techniques and methodologies

Page 18: Intentionally dealing with responsive design

Methods for building deliverablesDevelopment• Local development

• Production development framework

• Local, dev, qa, production cdn

• Documentation via the “Global Header”

• Github Enterprise

Page 19: Intentionally dealing with responsive design

Internal DefinitionPlatform

An abstract collection of technologies used for implementing a brand’s product(s):

Tesla is a web app platform used to create WSJ Responsive, Portfolio, Real Time and new web-based initiatives.

Page 20: Intentionally dealing with responsive design

Internal DefinitionProperty

An implementation of a brand on a platform:

The WSJ Responsive property is based on modern best-practices, whereas the WSJ iOS properties are based on fancy templating technologies.

Page 21: Intentionally dealing with responsive design

Design Delivery WorkflowThe story of how an idea becomes reality

Page 22: Intentionally dealing with responsive design

Design Delivery StepsWhile a design process must be flexible in an ever-changing, news-driven work environment, standards for application development are ideals, and not written in stone.

Discovery

IA Design

Design Tech

Integration &Deployment

Page 23: Intentionally dealing with responsive design

Editorial WorkflowThe process of storytelling

Page 24: Intentionally dealing with responsive design

Editorial Components• Who are editors, and what do they do?

• What do we mean by “content” ?

• What effects do the editorial process have on the design of a property?

Page 25: Intentionally dealing with responsive design

Internal DefinitionEditor

One who manages edits to a document, custom-tailoring a document to a specific platform, or managing the content hierarchy on a platform:

An editor changes what content is on the homepage, and can edit headlines.

Page 26: Intentionally dealing with responsive design

Internal DefinitionArticle

A story and associated metadata, e.g. interactives, graphics, photos, video or slideshows:

After its publishing, an editor can add additional supporting media onto an article.

Page 27: Intentionally dealing with responsive design
Page 28: Intentionally dealing with responsive design

Internal DefinitionCollection

A set of articles:

An editor can manipulate the mapping of articles in a collection before, during and after publishing.

Page 29: Intentionally dealing with responsive design
Page 30: Intentionally dealing with responsive design

Internal DefinitionModule

An instantiation and specific configuration of a collection articles on a web page:

A module’s appearance is determined by the presence or absence of articles in the collection that is bound to it.

Page 31: Intentionally dealing with responsive design
Page 32: Intentionally dealing with responsive design

Internal DefinitionTemplate (page)

A web page configuration, containing modules with specific collections:

The home page template contains many modules. Each collection may be controlled by a different editor, and can either be shared by multiple page templates, or used uniquely.

Page 33: Intentionally dealing with responsive design
Page 34: Intentionally dealing with responsive design

Editorial Content Rules• Editors control the design of a page by

manipulating the content in collections, which affects the aesthetic of modules.

• Modules can be placed flexibly in a page template, but are optimized to adhere to a design grid.

• The metadata content of an article can affect the aesthetic of a module.

Page 35: Intentionally dealing with responsive design

Module Aesthetic• An instantiation of a module can have a

configuration of the rules associated with it.

• The rules of a module can dictate the size of images allowed, the presence or absence of multimedia and the addition of adjacent, related content.

Page 36: Intentionally dealing with responsive design

Modules can be present because of a combination of content, newsworthiness, edition, subscription level and 3rd-party integration

Module Appearance

• Editions can be geo-specific (Europe, Asia) or audience-specific (CFO edition, Education).

• Subscription levels include anonymous, registered user, paid user, premium user, single sign-on, 3rd-party content aggregator, etc.

Page 37: Intentionally dealing with responsive design

Page RenderingThe output of a story

Page 38: Intentionally dealing with responsive design

( dynamicallyrequiredassets

Page Equation (approximate)

modules +edit requirements +user roles

targetplatforms

page ={ } *

cdndelivery/

( ))

Page 39: Intentionally dealing with responsive design

Templates, and their configured modules and content, and the user viewing them, are all variables to what the final experience is of any given page.

Optimized Rendering Techniques

• Dependencies are defined for each module.

• Dependencies are tracked separately for css and javascript.

• Dynamically created, concatenated css and js files are created for each page configuration, based on the currently useable modules.

Page 40: Intentionally dealing with responsive design

CSS Dependencies

reset.css

grid.css

typography.css

headlineSummary.css

HTML, CSS, Javascript documentationModule Assets

Header Strap

Article Content

Additional metadata

Image

Page 41: Intentionally dealing with responsive design

Modules are given a unique ID, which is then tied to collection configurations in a page template.

Module Asset Documentation

<unit id="headlineSummary">

<name="reset.css" />

<name="grid.css" />

<name="typography.css"/>

<name="headlineSummary.css"/>

</unit>

<unit id="whatsNews">

<name="reset.css" />

<name="grid.css" />

<name="typography.css"/>

<name="headlineSummary.css"/>

<name="whatsNews.css/>

</unit>

Page 42: Intentionally dealing with responsive design

Page templates have defined modules, and separately mapped appearance dependencies

Page Asset Configuration

<page>

<collection id="top">

<unit id="headlineSummary" />

</collection>

<collection id="top">

<unit id="whatsNews" />

</collection>

</page>

Page 43: Intentionally dealing with responsive design

Collection ConfigurationHeader Strap

Article Content

Additional metadata

Image

Header Strap

Article Content

Additional metadata

Image

Header Strap

Article Content

Additional metadata

Image

•reset.css

•grid.css

•typography.css

•headlineSummary.css

•whatsNews.css

Page 44: Intentionally dealing with responsive design

Page Asset Configuration

•reset.css

•grid.css

•typography.css

•headlineSummary.css

•whatsNews.css

•nav.css

•footer.css

•sidebar.css

Header Strap

Article Content

Additional metadata

Image

Header Strap

Article Content

Additional metadata

Image

Header Strap

Article Content

Additional metadata

Image

Page 45: Intentionally dealing with responsive design

Page Asset Configuration

Header Strap

Article Content

Additional metadata

Image

Header Strap

Article Content

Additional metadata

Image

Header Strap

Article Content

Additional metadata

Image

•reset.css

•grid.css

•typography.css

•headlineSummary.css

•whatsNews.css

•nav.css

•footer.css

•sidebar.css

•subscriber.css

Inside

Joke

Page 46: Intentionally dealing with responsive design

Code hand-off & iterationIntegration• Structured Wiki for Asset Documentation

• Front-end Dependency Management

Page 47: Intentionally dealing with responsive design

Production “Go Live” techniquesDeployment• CSS

• Per-server configuration rules

• Minified, re-written on upload

• Jenkins to NPM workflow for back-end modules

• Dependency-managed, dynamically-concatenated JS and CSS on a per-page basis

Page 48: Intentionally dealing with responsive design

Responsive DesignA brief history

Page 49: Intentionally dealing with responsive design

HTML with Inline Styles

Page 50: Intentionally dealing with responsive design

HTML & CSS

Page 51: Intentionally dealing with responsive design

TimelineResponsive Design

Graceful Degradation Progressive Enhancement

Mobile First

Responsive Design

Page 52: Intentionally dealing with responsive design

Responsive Design• Remove the concept of “mobile” from “mobile first”

• Create sites that are flexible for a variety of different sizes, interaction types

• Focus on key implementations of common context intersections

Page 53: Intentionally dealing with responsive design

Resizing the screen in Responsive Design

What size of device is the user

on?

http://wsj.com

Mobile-size optimized

experience

Load Additional Assets

Rich Interactive Site

Tablet

Desktop

Mobile

Tablet-size optimized

experience

Load Additional Assets

Custom Interactive Site Resized Window?

URL

Page 54: Intentionally dealing with responsive design

New York Times

Page 55: Intentionally dealing with responsive design

Quartz

Page 56: Intentionally dealing with responsive design

Time

Page 57: Intentionally dealing with responsive design

Boston Globe

Page 58: Intentionally dealing with responsive design

Boston Globe appears as if it was designed for each screen size it is rendered on.

Page 59: Intentionally dealing with responsive design

Tablet-optimized navigation is loaded in a medium size layout.

Page 60: Intentionally dealing with responsive design

Mobile layout is extremely focused on content, light on design.

Page 61: Intentionally dealing with responsive design

Performance Implications• Front-end only implementations can cause bloat

• Platform-specific approaches cause a degraded developer experience, end-user performance

• Major back-end investments are needed

Page 62: Intentionally dealing with responsive design

700k for BostonGlobe.com desktop is efficient.

~700k in assets

Page 63: Intentionally dealing with responsive design

The same assets for BostonGlobe.com Mobile are used, creating an efficient workflow, but an inefficient experience.

Same assets

Page 64: Intentionally dealing with responsive design

Hierarchy Implications• User expectations change depending on the device

type.

• Storytelling capabilities change depending on a number of concerns.

• Advertiser needs change depending on an intersection of the user and author needs.

Page 65: Intentionally dealing with responsive design

Theoretical 3-column 10-unit Page Layout

21

3

4

8

Looks pretty important

5 6 7

Page 66: Intentionally dealing with responsive design

Theoretical 2-column 6-unit Page Layout

21

3

4

8

5 6 7 Not very important

Page 67: Intentionally dealing with responsive design

Theoretical 1-column 3-unit Page Layout

2

1

3

4Is it even here? ?

Page 68: Intentionally dealing with responsive design

* The way of the future not guaranteed by any claims or statements, either direct or interpreted, via this presentation. No metrics were complied to support graphic flourishes used on this slide. Artisanal, locally-sourced drop shadows were used in the making of these pop-out labels. All characters portrayed in this slide are works of fiction. Any relationship between actual people, and the red stickers herein, are purely coincidental, and do not in any way imply a statement of grandeur for either the company, or the employees standing before you. Non-stick adhesive was used to adhere these stickers. Do not use rubbing alcohol to remove them. No expressed warranty is implied via the use of the techniques in this slide, but all warranties will be void if opened or damaged outside of the manufacturer's approved service centers.

Responsive DesignThe way of the future*

50% MoreHierarchy Problems

Major

Performance

Concerns

Buzzword

Approved

Page 69: Intentionally dealing with responsive design

Code Modifications• Media Queries are a band-aid to fix non-ideal

workflows.

• HTML is generally considered “locked in place”, whereas CSS and JS are flexible.

• The more generic html gets, the harder it is to have meaningful conversations about it.

Page 70: Intentionally dealing with responsive design

Designers talking to DevelopersCode Discussion

Generic code

Specific code

Easy to work with

Hard to work with

Ideal

Reality

Page 71: Intentionally dealing with responsive design

<style>.ten.columns { width: 100%; }.six.columns { width:60%; }.four.columns { width: 40%; }

@media all and (width:320px) {.ten.columns, .six.columns, .four.columns { width: 100%; }

}</style>

<section class="ten columns"><div class="six columns"> ... </div><div class="four columns"> ... </div>

</section>

Desktop-focused HTMLCode Discrepancies

Lies

Page 72: Intentionally dealing with responsive design

Generic HTMLCode Discrepancies<style>

.main { width: 100%; }

.secondary { width:60%; }

.tertiary { width: 40%; }

@media all and (width:320px) {

.main, .secondary, .tertiary { width: 100%; }

}

</style>

<section class="main">

<div class="secondary"> ... </div>

<div class="tertiary"> ... </div>

</section>

Vague / Meaningless

Page 73: Intentionally dealing with responsive design

Responsive Problems• Layout flexibility tends to increase likeliness of

performance problems.

• Hierarchy is limited by initial structure.

• HTML/CSS either is too broad, or too specific, and both need to be corrected for using additional code and techniques.

Page 74: Intentionally dealing with responsive design

Requirements of a Solution• Layout flexibility is a must.

• Performance of asset delivery must be evaluated at each step.

• Organizational change is difficult, and have a scaling level of complexity.

• Content flexibility of all types have to be considered constantly.

• Someone actually has to build and use it.

Page 75: Intentionally dealing with responsive design

Responding to Responsive DesignA departure

Page 76: Intentionally dealing with responsive design

mobile tablet desktop luxury

touch ? ?

mouse X X ?

The Intersection of ConcernsResponsive Grid

iPhone

Blackberry

Windows 8 Tablet

27" Monitors

Page 77: Intentionally dealing with responsive design

Internal DefinitionResponsive Axis

The intersection for disparate platform concerns, usually limited to interaction type and screen size:

The mobile responsive axis of an intentional site uses the assumptions that the target device set are approximately 3" wide, and touch-enabled.

Page 78: Intentionally dealing with responsive design

Internal DefinitionContext

The target user experience:

The user's intent in the mobile context is to have access to the latest information in the shortest amount of interactions.

Page 79: Intentionally dealing with responsive design

Proposed Public DefinitonIntentional Design (theory)

An approach to web design and devleopment that supersedes the DOM-based limitations imposed by responsive design:

An intentional design implements complete freedom of hierarchy, based on a per-context configuration.

Page 80: Intentionally dealing with responsive design

Public DefinitionIntention.js (library)

A framework-independent library for implementing the ideals of intentional design:

Dow Jones uses intention.js to circumvent the limitations of responsive design.

Page 81: Intentionally dealing with responsive design

Bandwidth optimizationResponsive Axis

Fast Slow

Page 82: Intentionally dealing with responsive design

Bandwidth, screen-size, interaction type intersectionResponsive Axis

Small

LargeFast Slow

Touch

Mouse

Page 83: Intentionally dealing with responsive design

Conflated Cube Conundrum Responsive Axis

Small

LargeFast Slow

Touch

Mouse

Low-res Hi-res

Page 84: Intentionally dealing with responsive design

Hypercube of hyperboleResponsive Axis

Small

LargeFast Slow

Touch

Mouse

Low-res Hi-res

Local Remote

Page 85: Intentionally dealing with responsive design

• Scroll depth

• Visit frequency

• Physical location

• Distance from screen

• Background noise

Responsive Axis (sample)• Screen size

• Pixel density

• Connection speed

• Interaction type

• User type

Page 86: Intentionally dealing with responsive design

• TV

• Kindle

• Jumbotron

• iWatch

Contexts• Mobile

• Tablet

• Standard

• Luxury

Page 87: Intentionally dealing with responsive design

Intentional Design (theory)

Responsive Axis Contexts( )( )intentions =

Ease of authoring + Editorial

flexibility

Page 88: Intentionally dealing with responsive design

SubtextEditorial Concerns

That might've been one of the shortest assignments in the history of Starfleet. I can't. As much as I care about you, my first duty is to the ship. We know you're dealing in stolen ore. But I wanna talk about the assassination attempt on Lieutenant Worf. About four years. I got tired of hearing how young I looked. Sure. You'd be surprised how far a hug goes with Geordi, or Worf. Maybe if we felt any human loss as keenly as we feel one of those close to us, human history would be far less bloody. When has justice ever been as simple as a rule book? Wouldn't that bring about chaos? Now we know what they mean by 'advanced' tactical training. Maybe we better talk out here; the observation lounge has turned into a swamp.

Sorry, Data. Commander William Riker of the Starship Enterprise. Could someone survive inside a transporter buffer for 75 years? You're going to be an interesting companion, Mr. Data. For an android with no feelings, he sure managed to evoke them in others. I'll be sure to note that in my log. Fear is the true enemy, the only enemy. Fate. It protects fools, little children, and ships named "Enterprise." Computer, lights up! Captain, why are we out here chasing comets? What's a knock-out like you doing in a computer-generated gin joint like this? And blowing into maximum warp speed, you appeared for an instant to be in two places at once. I suggest you drop it, Mr. Data. I am your worst nightmare! Earl Grey tea, watercress sandwiches... and Bularian canapés? Are you up for promotion? Smooth as an android's bottom, eh, Data? Is it my imagination, or have tempers become a little frayed on the ship lately? In all trust, there is the possibility for betrayal. The Enterprise computer system is controlled by three primary main processor cores, cross-linked with a redundant melacortz ramistat, fourteen kiloquad interface modules.

Congratulations - you just destroyed the Enterprise. This is not about revenge. This is about justice. The look in your eyes, I recognize it. You used to have it for me. What? We're not at all alike! Flair is what marks the difference between artistry and mere competence. Talk about going nowhere fast. We have a saboteur aboard. Worf, It's better than music. It's jazz. We could cause a diplomatic crisis. Take the ship into the Neutral Zone Some days you get the bear, and some days the bear gets you. Maybe if we felt any human loss as keenly as we feel one of those close to us, human history would be far less bloody. I've had twelve years to think about it. And if I had it to do over again, I would have grabbed the phaser and pointed it at you instead of them. Then maybe you should consider this: if anything happens to them, Starfleet is going to want a full investigation. Your shields were failing, sir.

Wait a minute - you've been declared dead. You can't give orders around here. Your head is not an artifact! They were just sucked into space. How long can two people talk about nothing? When has justice ever been as simple as a rule book? I'm afraid I still don't understand, sir. You did exactly what you had to do. You considered all your options, you tried every alternative and then you made the hard choice. I recommend you don't fire until you're within 40,000 kilometers. A lot of things can change in twelve years, Admiral. Travel time to the nearest starbase?

Page 89: Intentionally dealing with responsive design

Wait a minute - you've been declared dead. You can't give orders around here. Your head is not an artifact! They were just sucked into space. How long can two people talk about nothing? When has justice ever been as simple as a rule book? I'm afraid I still don't understand, sir. You did exactly what you had to do. You considered all your options, you tried every alternative and then you made the hard choice. I recommend you don't fire until you're within 40,000 kilometers. A lot of things can change in twelve years, Admiral. Travel time to the nearest starbase?

SubtextEditorial Concerns

That might've been one of the shortest assignments in the history of Starfleet. I can't. As much as I care about you, my first duty is to the ship. We know you're dealing in stolen ore. But I wanna talk about the assassination attempt on Lieutenant Worf. About four years. I got tired of hearing how young I looked. Sure. You'd be surprised how far a hug goes with Geordi, or Worf. Maybe if we felt any human loss as keenly as we feel one of those close to us, human history would be far less bloody. When has justice ever been as simple as a rule book? Wouldn't that bring about chaos? Now we know what they mean by 'advanced' tactical training. Maybe we better talk out here; the observation lounge has turned into a swamp.

Sorry, Data. Commander William Riker of the Starship Enterprise. Could someone survive inside a transporter buffer for 75 years? You're going to be an interesting companion, Mr. Data. For an android with no feelings, he sure managed to evoke them in others. I'll be sure to note that in my log. Fear is the true enemy, the only enemy. Fate. It protects fools, little children, and ships named "Enterprise." Computer, lights up! Captain, why are we out here chasing comets? What's a knock-out like you doing in a computer-generated gin joint like this? And blowing into maximum warp speed, you appeared for an instant to be in two places at once. I suggest you drop it, Mr. Data. I am your worst nightmare! Earl Grey tea, watercress sandwiches... and Bularian canapés? Are you up for promotion? Smooth as an android's bottom, eh, Data? Is it my imagination, or have tempers become a little frayed on the ship lately? In all trust, there is the possibility for betrayal. The Enterprise computer system is controlled by three primary main processor cores, cross-linked with a redundant melacortz ramistat, fourteen kiloquad interface modules.

Congratulations - you just destroyed the Enterprise. This is not about revenge. This is about justice. The look in your eyes, I recognize it. You used to have it for me. What? We're not at all alike! Flair is what marks the difference between artistry and mere competence. Talk about going nowhere fast. We have a saboteur aboard. Worf, It's better than music. It's jazz. We could cause a diplomatic crisis. Take the ship into the Neutral Zone Some days you get the bear, and some days the bear gets you. Maybe if we felt any human loss as keenly as we feel one of those close to us, human history would be far less bloody. I've had twelve years to think about it. And if I had it to do over again, I would have grabbed the phaser and pointed it at you instead of them. Then maybe you should consider this: if anything happens to them, Starfleet is going to want a full investigation. Your shields were failing, sir.

Page 90: Intentionally dealing with responsive design

WSJ.com public home page

Page 91: Intentionally dealing with responsive design

10-unit 959px grid

Page 92: Intentionally dealing with responsive design

10-unit header, 6/4 column split

Page 93: Intentionally dealing with responsive design

10-unit desktop grid

Page 94: Intentionally dealing with responsive design

6-unit tablet grid

Page 95: Intentionally dealing with responsive design

3-unit phone grid

Page 96: Intentionally dealing with responsive design

Idealized Hierarchy Modifications

Page 97: Intentionally dealing with responsive design
Page 98: Intentionally dealing with responsive design
Page 99: Intentionally dealing with responsive design

Idealized Content Wireframe

2aheader

1a

1b

1c

2b

2c

Page 100: Intentionally dealing with responsive design

DOM Folding

2aheader

1a

1b

1c

2b

2c

Page 101: Intentionally dealing with responsive design

DOM Folded Responsive Layout

2a

header

1a

1b

1c

• Secondary content folds under primary content

• Content hierarchy is subject to actual html page structure

• Editorial flexibility is fixed

Page 102: Intentionally dealing with responsive design

Idealized Content Reflow

2aheader

1a

1b

1c

2b

2c

Page 103: Intentionally dealing with responsive design

Futuristic Crazy Magic

2a

header

1a

1b

1c

• Content hierarchy defined separately for desktop, mobile

• Tools can be built to customize this

Page 104: Intentionally dealing with responsive design

Additional content may be displayed for users on larger, more capable devices.

More Content Visible

Page 105: Intentionally dealing with responsive design

21

3

Theoretical Page Layout4-columns 14-units

4

5 6 7

Ad 9

10 11

12 13

Odd Ad Placement

Page 106: Intentionally dealing with responsive design

21

3

Theoretical Page Layout4-columns 14-units

4

5 6 7

8 9

10 11

Ad

Valuable

Page 107: Intentionally dealing with responsive design

21

3

Theoretical Page Layout4-columns 14-units

4

5 6 7

8 Ad

9

10

Ridiculously Valuable

Page 108: Intentionally dealing with responsive design

• JS

• Bootstrap

• Breakpoints

• Conditionizr

• Aware

• HTML / CSS

• Regions

• Content-flow

• srcset

What exists already?

Page 109: Intentionally dealing with responsive design

HTML and CSSExisting techniques and solutions

Page 110: Intentionally dealing with responsive design

Current Media Queries• Limited axes

• screen dimensions (approximate)

• orientation

• pixel density

• Performance hit

Page 111: Intentionally dealing with responsive design

CSS Regions & Content Flow• Not backwards compatible

• Require per-page dynamically generated css authoring to emulate ideal behavior

Page 112: Intentionally dealing with responsive design

Srcset• Not backwards compatible

• Only for images, as currently specified

Page 113: Intentionally dealing with responsive design

JavascriptExisting libraries and techniques

Page 114: Intentionally dealing with responsive design

Aware.js and Breakpoints.js• Multi-class structure leads to harder-to-maintain

code at scale

• Fewer responsive axes

Page 115: Intentionally dealing with responsive design

Conditionizr• Good at managing low/high-res images, but only

aimed at image swapping

Page 116: Intentionally dealing with responsive design

What does a solution look like?• Context-abstracted front-end development

• Flexible assets that do not negatively impact performance

• Handle inflexible ads with grace

• Create sustainable workflows to support n-up contexts

Page 117: Intentionally dealing with responsive design

• Build a system that is not tied to a specific layout, screen size, or interaction model

• Create systems for outputting code efficiently for only the relevant context, in a way that does not preclude switching contexts

• Enable editorial hierarchy to be configurable on a per-context basis

Context-abstracted Front-end Development

Page 118: Intentionally dealing with responsive design

• Enable ad implementations to integrate the most relevant ad size and type per page context

• Ensure that the minimum configuration for a page context supports ads implemented

• Determine if ad calls should be issued per page request, or per context change

Ads deserve their respect

Your boss loves this slide!

Page 119: Intentionally dealing with responsive design

• Create documentation systems for validating target contexts, from an IA and QA perspective

• Inform the design process of the implications that target and variable contexts create

• Specify code-creation workflows that can tie into existing development systems, but encourage creation of new, optimized technical designs around the neccessities of performance Responsive Design

Sustainable Workflows

Page 120: Intentionally dealing with responsive design

2, 3 and 4-column module variations and code sample

<div class="col2wide"> ... </div>

<div class="col3wide"> ... </div>

<div class="col4wide"> ... </div>

Page 121: Intentionally dealing with responsive design

These should all be the same, but cannot be.

<div class="col2wide"> ... </div>

<div class="col3wide"> ... </div>

<div class="col4wide"> ... </div>

Page 122: Intentionally dealing with responsive design

10-unit phone grid

Page 123: Intentionally dealing with responsive design

3-unit phone grid

Page 124: Intentionally dealing with responsive design

Intentional DesignA philosophical introduction

Finally!

Page 125: Intentionally dealing with responsive design

• Clearer delineation between the responsibilities of html, css and javascript.

• Treat per-context content hierarchy as a first-class citizen.

• Go beyond the limitations of css-based media queries.

• Allows for one set of code to efficiently serve the needs of n-up contexts.

Core Ideas of Intentional Design

Page 126: Intentionally dealing with responsive design

Intention.jsA technical introduction

Page 127: Intentionally dealing with responsive design

A Formula for Implementing Responsive DesignA demonstration

Page 128: Intentionally dealing with responsive design

A few kinds of users• I want to hit the ground running Twitter bootstrap

style

• I’ve got really specific problems that need specific solutions

• Somewhere in between?

Page 129: Intentionally dealing with responsive design

What to use?• Intention.js

• allows you to create custom responsive contexts

• do things in those contexts

• Context.js

• an implementation of Intention.js with a whole lot of useful default responsive contexts

• can be easily extended to add your own

Page 130: Intentionally dealing with responsive design

Intention.js

Context.js

Your HTML

all your users' devices with your HTML

perfectly formatted

Page 131: Intentionally dealing with responsive design

Context.js ExplainedDescribing differencesKnowing when to expect one thing and not another

Page 132: Intentionally dealing with responsive design

Things that you can change• HTML classes

• Other attributes

• src, href, title, data-whatever, etc.

• Placement of an element in the document

• append, prepend, before, after

Page 133: Intentionally dealing with responsive design

Classes• Multi-value attribute

• Classes are applied as the union of all classes specified in the current contexts

• Does not mess with classes that are not specified

Page 134: Intentionally dealing with responsive design

Attributes• Single value

• In a conflict?

• Priority can be specified

Page 135: Intentionally dealing with responsive design

Placement• Same resolving strategy as attributes (priority)

• Four placements

• before

• after

• prepend

• append

Page 136: Intentionally dealing with responsive design

Context.js defaults• Base

• Touch

• Mobile

• Tablet

• Standard

• Highres

Page 137: Intentionally dealing with responsive design

Context.js defaults• Base

• Touch

• Mobile

• Tablet

• Standard

• Highres

axis

axis

axis

axis

Page 138: Intentionally dealing with responsive design

Context.js defaults• Base

• Touch

• Mobile

• Tablet

• Standard

• Highres

Screen resolution

Size (width)

Input

Fallback

Page 139: Intentionally dealing with responsive design

Context.js defaults• Base

• Touch

• Mobile

• Tablet

• Standard

• Highres

Priority 4

Priority 3

Priority 2

Priority 1

Page 140: Intentionally dealing with responsive design

Any combination of contexts, one from each axis, is possible

Page 141: Intentionally dealing with responsive design

• mobile

• touch

• highres

• base

Page 142: Intentionally dealing with responsive design

• base

• standard

Page 143: Intentionally dealing with responsive design

• base

• standard

• touch

Page 144: Intentionally dealing with responsive design

• base

• tablet

• touch

Page 145: Intentionally dealing with responsive design

Context.js: When do things change?• Widths (mobile, tablet, standard): on resize and

orientationchage

• touch: never. (it is or is not)

• highres: same

• base: always on

Page 146: Intentionally dealing with responsive design

Making ChangesThe HTML Interface

Page 147: Intentionally dealing with responsive design

Step 1: Indicating your intent<body intent> <header><nav intent>...</nav></header> <section> <h1 intent></h1> </section></body>

Page 148: Intentionally dealing with responsive design

Valid markup is supported<body data-intent> <header> <nav data-intent>...</nav> </header> <section> <h1 data-intent></h1> </section></body>

Page 149: Intentionally dealing with responsive design

Step 2: Specify what to change when

prefix-context-change="value"

i.e.in-mobile-class="threeColumn and more"

Page 150: Intentionally dealing with responsive design

Changing Classes<section intent in-mobile-class="threeColumn">...</section>

Page 151: Intentionally dealing with responsive design

Changing Classes With Valid HTML...

<section data-intent data-in-mobile-class="threeColumn">...</section>

// result in mobile:<section class="threeColumn"></section>

// result everywhere else:<section></section>

Page 152: Intentionally dealing with responsive design

Changing Classes<section class="headlineList" intent in-touch-class="swipe" in-mobile-class="threeColumn" in-tablet-class="sixColumn" in-standard-class="tenColumn">...</section>

Page 153: Intentionally dealing with responsive design

Results for iPhone 5

<section class="headlineList swipe threeColumn"></section>

<section class="headlineList" intent in-touch-class="swipe" in-mobile-class="threeColumn" in-tablet-class="sixColumn" in-standard-class="tenColumn"></section>

becomes:

Page 154: Intentionally dealing with responsive design

And for desktop <= 810

<section class="headlineList sixColumn"></section>

<section class="headlineList" intent in-touch-class="swipe" in-mobile-class="threeColumn" in-tablet-class="sixColumn" in-standard-class="tenColumn"></section>

becomes:

Page 155: Intentionally dealing with responsive design

Changing Classes How it Works• Formula using:

• Existing classes

• Classes to remove

• Classes to add

Page 156: Intentionally dealing with responsive design

Existing classes• Intention.js does not mess with them

• Might include classes that are specified via intention

• In which case it might mess with them

Page 157: Intentionally dealing with responsive design

What is to add?• All classes assigned to the current contexts

• Union of the classes specified in each attribute

Page 158: Intentionally dealing with responsive design

What is to remove?• What responsive axis (or group) triggered the

change?

• In Context.js this is only the width axis

• The union of all classes specified for contexts other than the valid context

• This will come up later

Page 159: Intentionally dealing with responsive design

Take this example<section class="headlineList" intent in-touch-class="swipe" in-mobile-class="threeColumn" in-tablet-class="sixColumn" in-standard-class="tenColumn">...</section>

Page 160: Intentionally dealing with responsive design

The current context is mobile<section class="headlineList" intent in-touch-class="swipe" in-mobile-class="threeColumn" in-tablet-class="sixColumn" in-standard-class="tenColumn">...</section>

So the classes to remove are:

sixColumn and tenColumn

Page 161: Intentionally dealing with responsive design

The Formula

(existing – remove) ∪ current = result

Page 162: Intentionally dealing with responsive design

The formula

(existing – remove) ∪ current = result

Unionthe objects that belong toexisting but not to remove

Page 163: Intentionally dealing with responsive design

Changing Arbitrary Attributes

<img title="beautiful image" intent in-mobile-src="small_image.png" in-highres-src="big_image.png" />

Conditional highres images

Page 164: Intentionally dealing with responsive design

Highest priority contextWhat gets applied?<img title="beautiful image" src="big_image.png" />

"highres" trumps size contexts

Page 165: Intentionally dealing with responsive design

<img title="beautiful image" src="" />

Oops...No context specified, that is what"base" is for...

Highest priority contextWhat gets applied?

Surprise!iPad 2 Low-res

Page 166: Intentionally dealing with responsive design

Conditional highres images do-over

<img title="beautiful image" intent in-base-src="small_image.png" in-highres-src="big_image.png" />

Page 167: Intentionally dealing with responsive design

<img title="beautiful image" src="small_image.png" />

Much better

Highest priority contextWhat gets applied?

Page 168: Intentionally dealing with responsive design

In order of lowest to highest priorityContext.js priority• base (default)

• mobile, tablet, standard (size)

• touch (input method)

• highres (screen resolution)

Page 169: Intentionally dealing with responsive design

Changing Placement• Same resolution strategy as any arbitrary attribute

• in-context-[placement]="[selector]"

• Placement=append, prepend, before, after

• Selector=any valid css selector

• $([selector]).[placement](element)

Page 170: Intentionally dealing with responsive design

Beyond the HTML

Page 171: Intentionally dealing with responsive design

Intention.js

Context.js

Your HTML

all your users' devices with your HTML

perfectly formatted

This makes

sense now!

Page 172: Intentionally dealing with responsive design

pluginA.js

Intention.js

Context.js

Your HTML

all your users' devices with your HTML

perfectly formatted

pluginB.js

Page 173: Intentionally dealing with responsive design

pluginB.js

Intention.js

pluginA.js

Your HTML

all your users' devices with your HTML

perfectly formatted

pluginC.js

Page 174: Intentionally dealing with responsive design

Events• Element events

• "intent" events are triggered on any element that has responsive attributes

• The intent object is passed as the second parameter to the callback

• Context events

• Context.js returns an "intent" object that can have events bound to it

Page 175: Intentionally dealing with responsive design

The "intent" event• $('#elm').on('intent', function(){ alert('woohoo');});

• The callback

• function(event, intent){ /* do stuff */ });

• Fires on every element added to intent

Page 176: Intentionally dealing with responsive design

Context specific events• intent.on('mobile', function(){ /* do something */ });

• The callback

• function(event, intent){ /* do stuff */ });

• Fires every time the context is entered

• Fires after the html manipulation occurs

Page 177: Intentionally dealing with responsive design

If using Context.js• Rely on all elements with the intent or data-intent attributes existing on page load to get the "intent" event

• Context.js queries the DOM as soon as it sets up all of the responsive functionality

Page 178: Intentionally dealing with responsive design

Adding Responsive Elements • At any time an element can be made responsive

• You can add one or many

• Attributes can be specified by generating html attributes dynamically or by providing a js object of options

Page 179: Intentionally dealing with responsive design

Adding multiple elements• Chaining works

• intent.add($('#element')).add($('#another'));

Page 180: Intentionally dealing with responsive design

Add element and specify responsive attributesintent.add($('#element'), {mobile:{class:'awesome'}});

<div id="element" intent in-mobile-class="awesome">...</div>

Page 181: Intentionally dealing with responsive design

Add all elements inside the "nav"intent.elements($('nav'));

<nav><div id="element" intent in-mobile-class="awesome">

<img intent in-mobile-src="grumpycat.gif" />

</div></nav>

Page 182: Intentionally dealing with responsive design

Rolling your ownExtending Context.js or starting from scratch

Page 183: Intentionally dealing with responsive design

Creating a responsive axisvar axis = intent.responsive(contexts),

alt = intent.responsive(ctx, matcher),

fancy = intent.responsive(ctx, match, measure);

function

function

array

Page 184: Intentionally dealing with responsive design

intent.responsive(contexts, match, measure);Contexts• Array of context objects

• [{name:'shallow'}, {name:'deep'}]

• Name property is required

• Used for the context event type

• Used for the responsive attributes

• i.e. in-shallow-class="fixed"

Page 185: Intentionally dealing with responsive design

intent.responsive(contexts, match, measure);Matchervar depth = intent.responsive(contexts);

// Default matching function:function(measure, context){ return measure === context.name;}

//so...depth('shallow'); // Makes "shallow" a current context// because the parameter to depth is // the measure parameter in the matcher

Page 186: Intentionally dealing with responsive design

intent.responsive(contexts, match, measure);Overriding Matchervar contexts = [ {name:'shallow', depth:200}, {name:'deep', depth:1/0}],

// Responsive function depth = intent.responsive(contexts, function(measure, ctx){ return measure <= ctx.depth; });

Page 187: Intentionally dealing with responsive design

So...depth(300); // deep

Page 188: Intentionally dealing with responsive design

intent.responsive(contexts, match, measure);Measure// responsive functiondepth = intent.responsive(contexts, matcherFunction, // measure function function(){ return $(window).scrollTop(); });

$(window).on('scroll', depth);

Page 189: Intentionally dealing with responsive design

How to create priority• The order of making responsive axis

• The first responsive axis definition is the lowest priority

• Can be re-prioritized via sorting the intent.contexts property

Page 190: Intentionally dealing with responsive design

How a plugin works• Checks for the existence of intent

• Adds responsive axis to the intent object

• Returns the intent object so other plugins can extend it

Page 191: Intentionally dealing with responsive design

A few responsive ideas• Page load time

• Scroll depth

• Integration of aware.js

• Time of day

• Returning visitor

• Time on site

• Geolocation

Page 192: Intentionally dealing with responsive design

Experiments:

Page 193: Intentionally dealing with responsive design

Angular.js integration• Custom directive

• "intent" becomes a directive to add elements to intention

app.directive('intent', function () { return { restrict:'A', link:function (scope, element, attrs) {

if(window.intent){ window.intent.add($(element), JSON.parse(attrs.intent)); } } };});

Page 194: Intentionally dealing with responsive design

Angular.js integration• The Markup (or can be completely standard

intention tags) looks like:<div intent='{mobile:{class:"beautiful"}'></div>

Page 195: Intentionally dealing with responsive design

Conditional CSS Stylesheet LoadercssLoader( //stylesheets to load ['css/amazing-touch-mobile.css', 'css/amazing-highres.css'], // when these contexts ['mobile', 'touch', 'highres']);

Page 196: Intentionally dealing with responsive design

Totally Impractical Animation Demo• Uses scroll depth on two different axis

• One to check forwards and backwards

• One to progress the animation based on scrolldepth

Page 197: Intentionally dealing with responsive design

Extending the responsive functionality of Twitter Bootstrap• Data attribute implementation of js widgets on top

of context specific intentional attributes

• Theoretically possible, and cool

Page 198: Intentionally dealing with responsive design

Lots to do, lots that can be done.Thank you.

Page 199: Intentionally dealing with responsive design

This presentation was created in New York, NY, Pittsburgh, PA and Austin, TX, based on research that began in October of 2011, representing the culmination of the Dow Jones Design Studio’s work towards a more flexible web design and development process.

Erin [email protected]

Intentionally Dealing with Responsive DesignDow Jones Design Studio, SXSW 2013, http://intentionjs.com

Joe [email protected]