the future of media queries?

56
the future of media queries?

Upload: yiibu

Post on 08-Sep-2014

10.041 views

Category:

Software


0 download

DESCRIPTION

A brief exploration of proposed Level 4 Media Queries and some thoughts about the future of the web. Presented at Responsive Day Out in Brighton on June 27 2014.

TRANSCRIPT

Page 1: The future of media queries?

the future of media queries?

Page 2: The future of media queries?

A brief chat (and my personal thoughts) on Level 4 Media Queries (etc…) !(W3C First Public Working Draft, 3 June 2014)

Page 3: The future of media queries?

@media (scripting)

Page 4: The future of media queries?

The scripting media query enables us to apply a style based on the presence/absence of JavaScript.

what it does

@media (scripting)value: none | initial-only | enabled

the user agent either doesn’t support a scripting language, or the support isn’t active for the current document

scripting is enabled during the initial page load, but not supported afterwards e.g. printed pages, proxy browsers

user agent supports scripting of the page and that support is active for the current document

Page 5: The future of media queries?

The ability to apply new styles when scripting is enabled feels like a stop-gap or (even worse) a false promise.

If you haven’t taken the time to build an application that functions without JavaScript, and/or progressively layer functionality based on feature-detection, applying a few last minute styles using a media query won’t save you.

thoughts...

Page 6: The future of media queries?

Besides, on modern browsers, lack of JavaScript “support” is rarely the problem. !Far more common are factors such as this...

• Scripts that don’t load due to poor connectivity. • Scripts that execute much later or slower than expected. • Scripts that fail due to differences in support level.

thoughts...

Page 7: The future of media queries?

@media (light-level)

Page 8: The future of media queries?

The light-level media query enables us to apply styles to suit one of three luminosity levels.

what it does

@media (light-level)value: dim | normal | washed

used in a dim environment, where excessive contrast and brightness would be distracting or uncomfortable e.g. night time

light level is in the ideal range for the screen, and doesn’t require adjustment

exceptionally bright environment, causing the screen to be washed out and difficult to read. e.g. bright daylight

Page 9: The future of media queries?

The specification intentionally refrains from defining the 3 levels in terms of a measurement in lux, for several reasons: !

• Devices equipped with a light sensor usually adjust the brightness of the screen automatically !

• Different screen technologies wash out at different ambient light levels. e.g. e-ink vs. liquid crystal !

• Many light sensors are inaccurately calibrated.

more...

Page 10: The future of media queries?

• Automatically adapting styles based on luminosity feels as if it could often do more harm than good. !

• Testing the impact of styles may also be difficult given the device diversity, and the fact that each device/browser may have different adaptation thresholds.e.g. How quickly they adapt to changes in luminosity and what amount of change will trigger an adaptation.

thoughts...

Page 11: The future of media queries?

For the time being, this specification might best be reserved as a trigger to prompt a manual change in theme or reading mode.

We notice it’s getting a bit dark in here. Would you like to switch to night mode?

No thanks! Yes please!

Don’t show this again.

thoughts...

Page 12: The future of media queries?

@media (pointer)

Page 13: The future of media queries?

the primary input mechanism of the device includes an accurate pointing device

the primary input mechanism of the device DOES NOT include a pointing device

the primary input mechanism of the device includes a pointing device of limited accuracy

what it does

@media (pointer)value: none | coarse | fine

touchscreen, Nintendo Wii controller, Kinect, Google Glass

stylus-based devices, mouse, touch pad

accurately positioned cursoraccurate pointer

awkward cursorgesture

finger

your head proxies the awkward cursoraccurately positioned cursor

TV, printer

The pointer media query is used to query the presence and accuracy of a pointing device.

Page 14: The future of media queries?

more...

“ unless i’ve misunderstood...it’s now the browser’s job to understand the pointing device “opportunity space” of each and every device on the planet...

If a device has multiple input mechanisms, the pointer media feature must reflect the characteristics of the “primary” input mechanism, as determined by the user agent.

Page 15: The future of media queries?

“which won’t change the media feature’s value

As the UA may enable the user to zoom, OR as secondary pointing devices may have a different accuracy…

more...

Page 16: The future of media queries?

“As the UA may enable the user to zoom, OR as secondary pointing devices may have a different accuracy, the user may be able to perform accurate clicks even if the value of this media feature is “coarse”...

more...

…and vice versa

Page 17: The future of media queries?

Unless the API enables the UA to dynamically adapt in real-time to detect the true primary device we really won’t know how much accuracy the user has at any given time...

(…and dynamically adapting a UI in real time as a user switches from mouse, to touch, and back to mouse would drive them mad regardless.)

thoughts...

Page 18: The future of media queries?

There’s possibly already too much diversity for this specification to be useful beyond the context of speciality apps, or the application of non-critical tweaks to multi-context UIs. !e.g. ensure everything works with and without a mouse, touch screen and keyboard, then apply non-destructive progressive enhancements as the context becomes clearer

thoughts...

Page 19: The future of media queries?

@media (hover)

Page 20: The future of media queries?

The hover query the user’s ability to hover over elements on the page.

what it does

@media (pointer)value: none | on-demand | hover

the primary pointing system CAN’T hover, or there is no pointing system.

the primary pointing system CAN hover, but it requires a significant action on the user’s part.

the primary pointing system CAN easily hover over parts of the page

Page 21: The future of media queries?

more...

“If a device has multiple input mechanisms, the hover media feature must reflect the characteristics of the “primary” input mechanism, as determined by the user agent. !Authors should be careful not to assume that the ':hover' pseudo class will never match on device where 'hover:none' is true, and should design layouts that do not depend on hovering to be fully usable.

Page 22: The future of media queries?

...so once again, best not to rely on the accuracy of this context and only apply hover-based styles as progressive enhancements (…as we should already be doing).

thoughts...

Page 23: The future of media queries?

@media (update-frequency)

Page 24: The future of media queries?

The update-frequency media query is used to query the ability of a device to modify the appearance of content once it has been rendered.

what it does

@media (update-frequency)value: none | slow | normal

once it has been rendered, the layout can no longer be updated. e.g. documents printed on paper.

the layout may change dynamically but the output device cannot render or display changes quick enough for users to perceive them as smooth animation e.g. e-ink, underpowered devices

layout may change dynamically and the output device is not unusually constrained in speed e.g. computer screens

Page 25: The future of media queries?

Could be useful as a means of triggering and/or disabling aspects of animation within a UI. Could be a bit tricky however to determine how to progressively enhance. !e.g. given the state of modern devices, it seems counterintuitive that “none” (i.e. paper!) could be the baseline… :-)

thoughts...

Page 26: The future of media queries?

@media (overflow-block/inline)

Page 27: The future of media queries?

The overflow-block media query describes the behaviour of a device when content overflows the viewport in the block axis.

what it does

@media (overflow-block)value: none | scroll | optional-paged |paged

no affordance for overflow in the block axis; any overflowing content is simply not displayed e.g. billboards

overflowing content in the block axis is exposed by allowing users to scroll to it e.g. computer screen

overflowing content in the block axis is exposed by allowing users to scroll to it but page breaks can be manually triggered e.g. slide-shows

content is broken up into discrete pages; content that overflows one page in the block axis is displayed on the following page e.g. e-book readers, printers

the vertical axis in horizontal writing modes

Page 28: The future of media queries?

The overflow-inline media query describes the behaviour of a device when content overflows the viewport in the inline axis.

what it does

@media (overflow-inline)value: none | scroll

no affordance for overflow in the inline axis; any overflowing content is simply not displayed e.g. billboards, Google Glass

overflowing content in the block axis is exposed by allowing users to scroll to it e.g. most computer screens

the horizontal axis in horizontal writing modes

Page 29: The future of media queries?

…I don’t know about you, but this is starting to not feel quite right.

Page 30: The future of media queries?

Part of me wants more media queries…though maybe not these exact ones.

Page 31: The future of media queries?

For example: Something you can do pretty easily on Android is modify layout based on a user’s default language setting…

Page 32: The future of media queries?

values-de

You do this by grouping assets using the relevant qualifiers. !At runtime, Android detects current device capabilities and load the most appropriate resources.

color

drawable

res

values

logo.png

icon.png

drawable-zh

logo.png

icon.png

only devices set to German will use what’s in this folder

only devices set to Chinese will use what’s in this folder

Page 33: The future of media queries?

This is super useful because 140 characters can hold up to 5x the amount of content when in Mandarin!

Page 34: The future of media queries?

Why should Chinese users have to suffer through a UI designed for more verbose languages such as German or Russian?

Page 35: The future of media queries?

Touch screen UI mode API level

notouch

stylus

trackball

finger

car

desk

television

appliance

v1

v2

v3

Layout direction Language & region MCC & MNC

ldrtl

ldltr

en

fr

en-rUS

fr-rFR

mcc310

loosely maps to platform version e.g. Gingerbread, Jelly Bean

country code

mnc004

docked with a...

no display!!

network code e.g. AT&T,T-Mobile

right to left

As a matter of fact on Android you can qualify and adapt layout based on tons of factors… (these are just some of the more interesting ones...)

For a full list see Providing resources

Page 36: The future of media queries?

…and layout is just one thing that you can adapt. You can use these qualifier to specify raster graphics, colour palettes, UI labels content and strings and collections of numeric values…

<abcd/>

<200dp>

layouts

density-independent values and dimensions

Page 37: The future of media queries?

You can also combine qualifiers to increase context specificity.

values-en-rUS-land-hdpi

language

region

orientation

pixel density

Page 38: The future of media queries?

…but on the other hand, I worry about stuff like this becoming the norm.

(heir-in lies the road to madness)

layout-en-rUS-land-car-hdpi-night-qwerty-trackball-...

Page 39: The future of media queries?

(…no comment)

Page 40: The future of media queries?

A few years ago, in a presentation called Reset the Web I floated the following idea…

possibly crazy

Page 41: The future of media queries?

<nav is=”native”> <ul>

<li>Home</li> <li>News</li> <li>Reviews</li>

</ul> </nav>

what if this….

Page 42: The future of media queries?

could map to “native” versions of all of these…?

Home

News

Reviews

Photos

Video

Magazine

Podcast

Topics

Apple Gives Share-holders More Input; Will Facebook Get the Message?

At its annual shareholders meeting on Thursday, Apple’s management bowed to pressure from key inves-tors and agreed to allow shareholders to elect board directors by a simple major-ity vote.

Now any new or current director standing for election who fails to receive support from a majority of share-holders must resign his

By Tim CarmodyFebruary 24, 2012 | 4:26 pm

At its annual shareholders meeting on Thursday, Apple’s management bowed to pressure from key in-vestors and agreed to allow shareholders to elect board directors by a simple majority vote.

Now any new or current director standing for election who fails to receive support from a majority of share-holders must resign his his or her position. At next year

By Tim Carmody February 24, 2012 | 4:26 pm

Apple Gives Shareholders More Input; Will Facebook Get the Message?Home

News

Reviews

Photos

Video

Magazine

Podcast

Topics

Home

News

Reviews

Photos

Video

Magazine

Podcast

Topics

MENU

Home

News

Reviews

PhotosHome News Reviews Photos

<nav is=”native”> <ul>

<li>Home</li> <li>News</li> <li>Reviews</li>

</ul> </nav>

what if this….

(banish the hamburger icon and just trigger a native “menu” component”

Page 43: The future of media queries?

…in many ways no different than writing one select menu, and relying on the platform to deliver the best combination of interface, behaviour and interaction….

desktop

Android

iOS

Page 44: The future of media queries?

A bunch of intelligent, responsive, platform-appropriate yet adaptable default components...

Page 45: The future of media queries?

Which once again makes me think of some of the lovelier bits about designing for Android…

Page 46: The future of media queries?

Take an agreed upon construct, declare the UI, and the device renders it in the most appropriate way…

…in this case using XML…a component

Page 47: The future of media queries?

notification behaviour: LED flash, audio, vibration

on a phone…

action action

contenticon/image

Page 48: The future of media queries?

RetweetReply

RT@jhagel: The Internet of the next billion - great presentationon the globalization of innovation spawned by the Web http://t.co/rNMOBxslQm

Bryan Rieger

Favourite

wearable device vibrates to notify of incoming message

user swipes to reveal actions, and taps to trigger them.

a watch…

Page 49: The future of media queries?

Google Glass: notifies user

with an audible chime

user taps, or... performs a “head wake” gesture

user taps... ...views card actions

user performs a voice reply

…and so on

Page 50: The future of media queries?

I’ll be the first to admit that this implementing this more widely could make for a VERY different web. But then again…we now live in a very different world.

Page 51: The future of media queries?

…[Bob] connects his phone to the car, and can now use the familiar car controls, steering wheel buttons, console dials, touch screens to control it. It looks and feels as if it's part of the car,…it also means that he has a personalised experience, that he can bring with him into any compatible car.

“- Google I/O 2014 keynote yep…silos are still a big risk, but

today’s web is at risk as well

Page 52: The future of media queries?

To a certain degree, we’re already developing technologies that align with this thinking…

Page 53: The future of media queries?

(…or at least have the potential to do so.)(throw in element query style encapsulation behaviours, and we really have something!)

Page 54: The future of media queries?

Developing new technologies is the easy part.

Understanding which ones we truly need, and for what is far harder, but will be even more important going forward if we wish to build a stronger and more future-friendly web.

Page 55: The future of media queries?

“Everything is best for something and worst for something else. The trick is knowing what is what,

for what, when, for whom and most importantly, why” - Bill Buxton (in a great many contexts)

https://www.flickr.com/photos/dcoetzee/3885789043

Page 56: The future of media queries?

http://www.flickr.com/photos/tinou/453593446

thank you

many thanks to the amazing photographers on

http://creativecommons.org/licenses/by/2.5

@yiibu

[email protected] us at

Presentation deck available @http://www.slideshare.net/yiibu