Just what is it that you want to do?

November 3rd, 2014

The supersmart Scott Jenson just gave a talk at The Web Is in Cardiff, which was by all accounts, excellent. I wish I could have seen it, but I’m currently chilling out in Florida and I haven’t mastered the art of bilocation.

In it, he takes to task the idea that—through progressive enhancement—you should be able to offer all functionality to all browsers, thereby foregoing the use of newer technologies that aren’t universally supported.

If that were what progressive enhancement meant, I’d be with him all the way. But progressive enhancement is not about offering all functionality; progressive enhancement is about making sure that your core functionality is available to everyone. Everything after that is, well, an enhancement (the clue is in the name).

The trick to doing this well is figuring out what is core functionality, and what is an enhancement. There are no hard and fast rules.

Sometimes it’s really obvious. Web fonts? They’re an enhancement. Rounded corners? An enhancement. Gradients? An enhancement. Actually, come to think of it, all of your CSS is an enhancement. Your content, on the other hand, is not. That should be available to everyone. And in the case of task-based web thangs, that means the fundamental tasks should be available to everyone …but you can still layer more tasks on top.

If you’re building an e-commerce site, then being able to add items to a shopping cart and being able to check out are your core tasks. Once you’ve got that working with good ol’ HTML form elements, then you can go crazy with your enhancements: animating, transitioning, swiping, dragging, dropping …the sky’s the limit.

I’m not suggesting that you try and replicate all your JavaScript functionality when it’s disabled, above all that’s just not practical. What you should be aiming for is being able to complete the basics - for example adding a product to a shopping cart and then checking out. This is necessarily going to be clunky as judged by current standards and I suggest you don’t spend much time on optimising this process.

Scott asked about building a camera app with progressive enhancement:

Snarky Question: How are you supposed to ‘progressively enhance’ an HTML camera app? Show puppies? Not everything devolves to simple markup

Here again, the real question to ask is “what is the core functionality?” Building a camera app is a means to an end, not the end itself. You need to ask what the end goal is. Perhaps it’s “enable people to share photos with their friends.” Going back to good ol’ HTML, you can accomplish that task with:

<input type="file" accept="image/*">

Now that you’ve got that out of the way, you can spend the majority of your time making the best damn camera app you can, using all the latest browser technologies. (Perhaps WebRTC? Maybe use a canvas element to display the captured image data and apply CSS filters on top?)

Scott says:

My point is that not everything devolves to content. Sometimes the functionality is the point.

I agree wholeheartedly. In fact, I would say that even in the case of “content” sites, functionality is still the point—the functionality would be reading/hearing/accessing content. But I think that Scott is misunderstanding progressive enhancement if he think it means providing all the functionality that one can possibly provide.

Mat recently pointed out that there are plenty of enhancements on the Boston Globe site that require JavaScript, but the core functionality is available to everyone:

@jgarber@mjacksonw Right. Lots of cool features on the Boston Globe don’t work when JS breaks; “reading the news” is not one of them.

What I’m chaffing at is the belief that when a page is offering specific functionality, Let’s say a camera app or a chat app, what does it mean to progressively enhance it?

Again, a realtime chat app is a means to an end. What is it enabling? The ability for people to talk to each other over the web? Okay, we can do that using good ol’ HTML—text and form elements—with full page refreshes. That won’t be realtime. That’s okay. The realtime part is an enhancement. Use Web Sockets and WebRTC (in the browsers that support them) to provide the realtime experience. But everyone gets the core functionality.

Like I said, the trick is figuring out what’s core functionality and what’s an enhancement.

Ethan provides another example. Let’s say you’re building a browser-based rich text editor, that uses JavaScript to do all sorts of formatting on the fly. The core functionality is not the formatting on the fly; the core functionality is being able to edit text:

@scottjenson That was how we approached @geteditorially’s rich editor, anyway: start with a textarea, layer on functionality from there.

If progressive enhancement truly meant making all functionality available to everyone, then it would be unworkable. I think that’s a common misconception around progressive enhancement; there’s this idea that using progressive enhancement means that you’re going to spend all your time making stuff work in older browsers. In fact, it’s the exact opposite. As long as you spend a little bit of time at the start making sure that the core functionality works with good ol’ fashioned HTML, then you can spend most of your time trying out the latest and greatest browser technologies.

As Orde put it:

What you are going to be spending the majority of your time and effort on is the enhanced JavaScript version as that is how the majority of your customers will be experiencing your site.

For us, building with Progressive Enhancement moves almost all of our development time and costs to newer browsers, not older ones.

Progressive Enhancement frees us to focus on the costs of building features for modern browsers, without worrying much about leaving anyone out. With a strongly qualified codebase, older browser support comes nearly for free.

Approaching browser support this way requires a different way of thinking. For everything you’re building, you need to ask “is this core functionality, or is it an enhancment?” and build accordingly. It takes a bit of getting used to, but it gets easier the more you do it (until, after a while, it becomes second nature).

But if you’re thinking about progressive enhancement as “devolving” down—as Scott Jenson describes in his post—then I think you’re on the wrong track. Instead it’s about taking care of the core functionality quickly and then spending your time “enhancing” up.

Scott asks:

Shouldn’t we be allowed to experiment? Isn’t it reasonable to build things that push the envelope?

Absolutely! And the best and safest way to do that is to make sure that you’re providing your core functionality for everyone. Once you do that, you can go nuts with the latest and greatest experimental envelope-pushing technologies, secure in the knowledge that you don’t even need to worry about the fact that they don’t work in older browsers. Geolocation! Offline storage! Device APIs! Anything you can think of, you can use as a powerful enhancement on top of your core tasks.

Once you realise this, it’s immensely liberating to use progressive enhancement. You can have the best of both worlds: universal access to core functionality, combined with all the latest cuting-edge technology too.

progressive enhancement is not about offering all functionality; progressive enhancement is about making sure that your core functionality is available to everyone. Everything after that is, well, an enhancement (the clue is in the name).Jeremy Keith
It is more often than not that I find myself in discussions about this exact point: I want our websites, their core tasks, to function, and if this is cared for, then we can talk about the fun stuff.
To many people this, in our new and modern browser times, seems to be a waste of time, why care for systems or users without javascript, that’s only those web fundamentalists like you, I was told on one occasion. There are plenty of good reasons to do so, but first of all, the layered approach from function to representation to behaviour to me seems only logical when working with the web’s building blocks. Working with, not against, them.
But this needs planning, strategy, and sometimes there seems to be no time and/or budget for this – it’s only a small webpage, let’s throw some javascript driven ui widgets together and be done with it, why don’t you?
So it’s good to have this article by Jeremy Keith to refer to, since it explains very clearly and takes good care of some ‘counter’ arguments, thank you, Jeremy.

One of the key benefits ascribed to progressive enhancement is that your site works for everyone. That is almost true. But we need to be clear what we mean by “everyone”.
A recent polite disagreement between Scott Jenson and Jeremy Keith, both of whom I admire immensely, made me finally put into writing something that’s been bothering me about progressive enhancement idealism for a while. The principle has it that if you start with ‘good ol’ HTML’, it will work everywhere, and then you can add CSS and JavaScript to enhance it. Literally everything except the markup (and even much of the markup) is an enhancement.
This is fine up to (or rather down to) a point. Jeremy and Scott use the example of a camera app, where you could consider it to be a progressively enhanced . But does that really work for everyone? Taking IE as an example:
You’re probably not testing in anything lower than v6
File inputs were first supported in v4
JavaScript support has been available since v2
Reality: The ‘core functionality’ doesn’t work for everyone
So how do we define “everyone”? In this case it evidently doesn’t include anyone using IE 1, 2 or 3 since the core solution isn’t supported by those browsers. And virtually nobody does use them, I know. But does it even include users of 4 and 5? You’re serving JS code to these browsers, and not testing it. Not tested means probably not working, because no browser can be relied upon to interpret and render standards-compliant code correctly whilst ignoring stuff they don’t understand (especially old ones). I don’t think a single legacy browser can claim to do this. Added to all this there are literally no versions of IE that support file inputs but not JavaScript, so what exactly are we achieving here?
Beware of the leopard
Even if you devise some way in which your user can achieve their supposed aim with the most basic browser functionality, and it works ‘everywhere’, you will probably be providing such a laughably awful experience that absolutely no-one is going to use it.
In the Hitchhiker’s guide to the galaxy, Arthur Dent is surprised that the council want to knock down his house, because he hasn’t seen the planning application that has been clearly on display in a pitch dark basement with no stairs on the back door on a toilet cubicle with a ‘beware of the leopard’ sign on it. The reality is that most modern web products are designed not for web gurus who are willing to tolerate endless steps, but for normal humans. And in many cases they’re designed to be easier ways of doing something that is already possible. As a result it’s totally pointless to also support a way of doing it that’s harder than what’s already possible. A user that signs up for a camera app is not going to be very happy if it doesn’t actually take the pictures.
There is nothing wrong with “Browser not supported”
Progressive enhancement is a valuable mechanism, and it helps us bring new features to users faster. All the things Jeremy cites as no-brainers are exactly that. Rounded corners, web fonts, gradients, all indisputably enhancements. But when it comes to complex script-powered elements, we should not feel the need to support some catastrophically awful user experience for a tiny number of users. A much better user experience for the camera app is to simply show a message like this:
Your browser is too old to use the camera app. The app works with any browser that includes the getUserMedia feature. Learn about free upgrade options
This isn’t always the case, and of course you can often be more granular. For example, many sites now have very rich commenting interfaces. You could argue that ancient browsers should still be able to comment, but for that tiny audience, what’s wrong with printing a selection of comments and the message:
To add your own comment, you need to upgrade your browser
At the FT we use the seamless progressive enhancement of ‘optional’ features, but also define a moveable baseline using a cuts the mustard test, below which we are happy to replace some of what you might consider core functionality with messages like the one shown above.
Everything is, in the end, a judgment call – login and sign up might work below the baseline, but commenting, ‘save for later’, ‘email a friend’ and so on don’t. Some of these features might show upgrade messages, others might vanish completely.
And of course even an ultra-simplified site is expected to break if you go back far enough in the browser versions. No matter how you cut it, nothing is going to work for everyone. For sure, taking a PE approach allows you to be more inclusive without a lot more effort. But being inclusive doesn’t mean being universal.
The way I look at it, I make reasonable attempts to serve the largest practically addressable audience with the most important features. As long as that’s what you mean by ‘everyone’, we’re on the same page.
I don’t have comments enabled on this blog, but if you want to respond feel free to send me a tweet!.