A plea for progressive enhancement

From: Stephanie Rieger

This is vitally important people so listen up. The web now connects a third of our planet. Over 1.2 billion people [1] use the web on devices, and this number is rising fast. Mobile already amounts to close to 6.5% of web traffic worldwide, and large sites such as Facebook and YouTube routinely report mobile traffic of at least 30%. By 2015, the ITU predicts mobile traffic will exceed desktop traffic and the ‘mobile-mostly’ group already make up a staggering 20% of users in the US and UK.

For this ubiquity to truly benefit all of us (not just those of us with a high income, or the latest phone) we have to start building sites using solid, future friendly principles such as progressive enhancement…not just when it’s handy or simple, but all the time. Here’s a very timely example of why…

Last night Brad Frost posted a picture of the lovely sliding side menu contraption on Barack Obama’s new responsive campaign site. As shown in the image below, It looked quite nifty. You tap on the icon next to the word Menu, and the menu slides open from the left hand side. So I decided to try it out on my iPhone 4.

And the menu failed. Never even opened. Suddenly, the site was without navigation…at all.

On a hunch, I tried it on a handful of popular devices. The results were pretty devastating. These are the browsers (and devices) where the menu worked as expected.

  • Galaxy Nexus (hot off the assembly line last week with Ice Cream Sandwich and a mobile version of Chrome)
  • iPhone 4 (with iOS 5)

These are the ones where it didn’t.

  • iPhone 4 (with iOS 4.3.5…the prior version of iOS)
  • iPod Touch (still very popular, especially with youth)
  • Nexus One (old but top of the line Google reference device in its day)
  • Nokia Lumia 800 (brand new Windows Phone 7 device with Internet Explorer 9)
  • HTC ChaCha (popular QWERTY phone with dedicated Facebook button and Android 2.3.3 )
  • HTC Wildfire (very popular mid-range phone with Android 2.3.3)
  • Huawei Blaze (brand new, £50 phone with Android 2.3.5 )
  • Galaxy SII (top of the line device with Android 2.2.3)
  • Galaxy Mini (cheap, low-spec phone with Android 2.2.1 )
  • Blackberry 9810 Torch (one of their newest devices with WebKit-rich Browser 7.0)
  • Blackberry 9300 (a slightly older 6.0 device with a WebKit browser)
  • Galaxy Tab 7″ (first generation tablet with Android 2.3)
  • Galaxy Tab 10″ (second generation tablet withAndroid 2.3)
  • Amazon Kindle Fire (proxied Amazon Silk browser)

These devices are pretty new. With the exception of the Nexus One and the older Galaxy Tab, all these devices are for sale in the UK right now. Most are also for sale in the US. And at least four of these are top of the line, flagship devices for their brand. And to be clear, the menu wasn’t merely a bit flaky on these devices. It never opened at all (and this is a big, presumably important menu…with 20 sub-navigation items).

On all devices except the Galaxy Nexus, Kindle Fire, and 10″ Tab, at least a third of the content also loaded offscreen, resulting in a perpetual horizontal scroll. To make matters worse, the viewport meta tag had been set to ‘maximum-scale=1′, preventing most browsers (and therefore users) from zooming to temporarily rectify the horizontal scroll issue.

We also tried the site on some lower end devices (70% of the US and about half the UK still use feature phones) but gave up. The site was too heavy and complex to render gracefully on many of these devices. (And incidentally didn’t load at all past the ‘splash page’ using Opera Mini on the iPhone).

This on a site whose goal was to reach as many Americans as possible, regardless of age or income level. As it stands the site only appears suitable for the Google staff who received a Galaxy Nexus for Christmas, and the maybe 5% [2] of Americans who own (and have recently updated) their iPhone.

I can’t speak to exactly what’s causing the menu to fail, but I can take a pretty good guess. I’m also fairly sure that a progressive enhancement approach (combined with a good dose of testing) would have solved (and certainly uncovered) all the problems we encountered. As a matter of fact, we’ve recently been working on a (still to be launched) client project with a similar (but far simpler) collapsible, sliding menu and went to great pains to ensure things like this didn’t happen.

First, we built the menu to fail gracefully. In this case, it meant building a menu that was open by default, and only closed once the page had loaded. If the JavaScript failed, the menu would simply never close. It might not look terribly graceful, but it would still be fully usable (to navigate…not to slide open and shut triggering fancy animations…that’s not the menu’s actual job.)

Secondly, we built the menu using ‘normal’ JavaScript rather than jQuery, as we’ve found jQuery still doesn’t work reliably across devices (in particular for tasks such as DOM selection). We also tested the JavaScript based functionality all the way back to dinky, underpowered little phones like the Nokia N95. This served as a reality check and helped further minimise our points of failure. If it works on a 5 year old browser, it’s considerably less likely to fail on today’s devices.

And finally, we identified browsers with inadequate levels of JavaScript or DOM manipulation support and served an entirely different menu to this group. We swapped this out server side to ensure these devices didn’t receive the JavaScript at all, and newer devices didn’t have the client-side burden of negotiating the switch from one menu to the other. Incidentally, we also built the site ‘mobile-first’ (i.e. for the simplest device first…and no, that device is not the iPhone), so the ‘fancy’ menu doesn’t even kick in until you reach a screen size of 320 px (regardless of whether JavaScript may be supported). This may penalise the tiny number of devices that happen to be below 320 px in width, and have awesome JavaScript, but also minimises the chance that weaker, older devices will try to load the menu accidentally.

Despite all this, we still had issues, namely with general DOM manipulation flakiness and inconsistencies caused by device-specific events such as zooming, reorientation, or adjustment of Zoom settings (especially on Android…and especially on HTC). For this reason, we found that the calculations required to correctly trigger and execute the animation sometimes failed, resulting in an only partially open menu. So in the end, we removed the animation altogether (especially as this problem wasn’t limited to lower-end devices so it wasn’t possible to simply conditionally load the animation based on say…the browser version).

A final problem was the visual disruption caused by a menu that initially loads open, but then quickly closes. To be honest, we still haven’t decided what to do about this. This is a site with a strong accessibility (as in access…) mandate so the idea of shipping a menu that may sometimes never open doesn’t sit well with any of us. So we’re still discussing it. Given this site’s small proportion of traffic from low-end devices, and the measures we’ve taken to ensure the menu will work most of the time, we may still choose to chance it and go the other way.

These are complex problems. Problems that cause us to examine the true goals of what we’re building and very often greatly test our assumptions around the value of design. Even seemingly inconsequential decisions such as constraining the zoom level can have unintended consequences. But progressive enhancement doesn’t just happen. It needs to be planned from the start, then iterated and carefully discussed when things go wrong. And on mobile, the only way to know that things have gone wrong is to test on actual devices. Given that a good 80% of the Android devices we tested displayed content off-screen, we’d be surprised if barackobama.com had been tested on Android at all.

We have an opportunity to make the mobile web a million times more useful and relevant than the desktop web has been. The failure of the Obama site was not in the use of new techniques like responsive design, it was in forgetting that older principles and techniques still have an important role to play in building a better web. If anything, they are more important than ever before. Without progressive enhancement, responsive design is simply a site that looks pretty when you resize your desktop browser. With progressive enhancement, the mobile web truly becomes a tool, capable of reaching and connecting all of us. Which is it going to be?

—————-

[1] A statistic from analyst Tomi Ahonen’s awesomely useful 2011 Phone Book.

[2] 5% is an educated guess. Current Nielsen figures show US smartphone penetration at 38%. The iPhone is 28% of that 38%. The number of people with an iOS 5 capable iPhone is smaller, and the number who will have upgraded is smaller still.