
Why we use progressive enhancement to build Gov.uk - joelanman
https://gdstechnology.blog.gov.uk/2016/09/19/why-we-use-progressive-enhancement-to-build-gov-uk/
======
Taig
I really appreciate that kind of focus and dedication. I recently had another
dive into web development after a couple years of absence and was pleasantly
surprised by tools like react. In combination with server side rendering it
allowed me to serve a solid/usable HTML page with no JS required. When I
started pulling in components from popular Material Design libraries, though,
I realized that nobody thought about progressive enhancement even for a
second. Rather than serving a plain `<select />` and then progressively
enhancing it, all I got was an unusable mix of HTML tags and styling. It's a
shame that even down at the library level people don't care about progressive
enhancement. Are there any (react) projects that try to do better or is the
mantra more like: react without JS is nonsense?

~~~
s_kilk
There's no substitute for caring, and unfortunately much of the contemporary
JS/Web world just doesn't care about these issues.

~~~
masklinn
> There's no substitute for caring

Or for being paid, progressive enhancement is more work than not doing it and
if the client/manager/… doesn't want to pay for it… the dev is unlikely to
bother doing it on their own dime.

~~~
Cthulhu_
The 80 / 20% rule applies once more - why spend 80% of work on the 20% of
users that would benefit from progressive enhancement? Unless those 20% of
users generate 80% of revenue, which in all likelihood they don't.

~~~
dasil003
I'm a startup guy so of course I understand this, but on the other hand
accessibility is one of those things that takes practice and know-how, so if
you never do it of course it seems like this giant mountain to climb. However
if you make it a priority, it's not 80% of the work, more likely it influences
how you do things, so maybe you spend 20% more effort and end up with a little
less whiz-bang. There _is_ a cost, but we shouldn't paint it as an
insurmountable thing. This is why we have the ADA, so that people with
disabilities don't have to go through life as second-class citizens.

------
zeveb
This, this, _so much_ this.

We owe it to our users to provide _all_ of them with a good experience. We
also owe it to ourselves to write good, clean, maintainable applications. The
wonder of it is that very, _very_ often if we write RESTful apps then
progressive enhancement just falls out naturally: a GET request with some JSON
Accept header will return data; with text/html it'll return data, and possibly
a form to update it; a POST with some JSON Content-Type will DTRT, and so will
one with application/x-www-form-urlencoded or multipart/form-data.

Why _wouldn 't_ one do that?

Of course, the user experience of such an app isn't as great as a singing,
dancing single-page app (SPA). But _a_ user experience is better than _no_
user experience, which is what offering _only_ an SPA provides.

It's just sloppy to require JavaScript and CSS to use a web site. It's
particularly sloppy when that web site is composed of documents.

~~~
borplk
For government websites I can understand it but for commercial stuff I think
this attitude of "everyone must be supported at all cost" is nonsensical.

Where do you draw the line?

Do I have to also support people who prefer to use command line text-based web
browsers?

Before you know it we'll have someone say "Oh I work for a bank, we have HTML
disabled here. Can you make it work without HTML?" give me a break.

~~~
zeveb
> Do I have to also support people who prefer to use command line text-based
> web browsers?

Yes. The web is about linked HTML documents: if you don't support lynx, links,
elinks, w3m, emacs-w3m & eww then you're honestly not doing Web development
properly.

You have to do _more_ work to not support them, because writing plain HTML +
forms is the baseline.

> Before you know it we'll have someone say "Oh I work for a bank, we have
> HTML disabled here. Can you make it work without HTML?" give me a break.

That wouldn't be using the Web anymore.

~~~
matthewowen
Many people aren't building websites. They're building applications which
target the cross-platform runtime and APIs provided by modern web browsers.

~~~
TeMPOraL
Many of those people _should not_ be building applications. Boilerplate
startup landing pages, blogging platforms and e-commerce sites should be
websites, as they always were.

As for those who really are building web _applications_ \- well, those are
separate beasts. Nobody expects to run Google Docs or Gliffy properly in lynx.
But I do expect my banking site to run in a text browser, because there's no
valid reason it shouldn't.

(Yes, I understand the business reasons for the current sad state of the web.
I also believe those reasons are things one should be _ashamed of_.)

------
adrianratnapala
I like the reasons they give why users might not have JS, even though they
haven't blocked it themselves. Here are three:

* _user’s hotel is intercepting the connection and injecting broken JavaScript_

* _user’s telecoms provider is intercepting the connection and injecting broken JavaScript_

* _user’s country is intercepting the connection and injecting broken JavaScript_

Broken or not: all three of those sound like good reasons to intentionally
block JS.

~~~
josteink
* ...provider is intercepting the connection and injecting broken JavaScript

Who the hell puts up with stuff like this? Is this real?

If so, time to switch provider. Really.

~~~
DanBC
I think all mobile providers in UK do it, especially around downgrading
images.

~~~
josteink
At that point I would either be switching providers to someone who didn't
mangle my signal (because that's effectively what this is), or if that for
some reason wasn't doable, I would at least install a VPN to a known secure,
untampered connection (like my home router) and route everything through that
connection.

Having someone intercept my signal and process it behind my back is simply not
something I would tolerate from any communications-service provider I employ.

~~~
paublyrne
You are part of a tiny minority who has the technical interest / proficiency
to do this.

------
PieterH
The gov.uk site is wonderful to use! It is incredibly fast, just a tenth of a
second latency, it feels.

~~~
josteink
> The gov.uk site is wonderful to use! It is incredibly fast, just a tenth of
> a second latency, it feels.

That's because unlike "modern" sites, it contains the site's contents in the
HTML, so when the HTML is loaded, you have everything you came for.

    
    
        % curl  https://gdstechnology.blog.gov.uk/2016/09/19/why-we-use-progressive-enhancement-to-build-gov-uk/ >test.html
        % du -h test.html
        36K
    

That amount of data can still be downloaded over the slowest mobile link
imaginable in a fraction of a second. And whatever scripts are needed to do
whatever extra can be downloaded and happen after the fact. That's how the web
used to work.

Compare to "modern" SPA-monstrocities (like blogger.com until recently), where
you had actual code written to _defer showing the (1KB) content_ (which you
came for), until several MBs of fonts, scripts and whatever had loaded, parsed
and executed.

It was enough to make page-loading on a high-speed connection of a modern PC
take many many _seconds_. On a mobile phone with a weak CPU this can lock your
phone up for quite a time.

If that's not an anti-pattern I don't know what is.

We need to get back to the basics. The basics worked, and the direction we're
heading is doing all the wrong things.

~~~
zeveb
> Compare to "modern" SPA-monstrocities (like blogger.com until recently),
> where you had actual code written to defer showing the (1KB) content (which
> you came for), until several MBs of fonts, scripts and whatever had loaded,
> parsed and executed.

Whoever came up with that idea should be loaded, parsed and executed.

> We need to get back to the basics. The basics worked, and the direction
> we're heading is doing all the wrong things.

Frankly, it's gotten to the point that I don't even like using my smartphone
anymore. Even with uBlock, sites take too long to load, they do annoying
things with animations, colors and behaviour, and it's just generally a
_burden_ to use.

I just want to be able to read documents and follow links to other documents.
The Web was awesome when it was a web of documents, linked together.

~~~
markdown
> sites take too long to load, they do annoying things with animations, colors
> and behaviour, and it's just generally a burden to use.

YOU THERE! YOU, SILLY USER!! YOU'RE SCROLLING WRONG. LET ME HANDLE SCROLLING
FOR YOU!!

------
georgespencer
I'm glad GDS is working to improve gov.uk sites but some really simple things
still seem broken. Example: it'd be great if GDS would stop with the
ridiculous forced password recipes across gov.uk sites.

Today I had to try three times to get 1password to satisfy the insane
requirements of the site (8-12 alphanumerics, no special characters).

~~~
UK-AL
I'm not surprised really, since the sort of services you can access with a
gov.uk account can lead to identify theft or other types of fraud.

~~~
lmm
So require a long password. Limiting passwords on an important site to 12
characters is madness.

------
JohnMH
The JavaScript annoyance will always be a part of web development at this
point, but I really don't see why so many people use these single-page
applications and _require_ JavaScript to perform simple tasks.

~~~
sanderjd
Because full page loads are a poor user experience for many actions a user can
perform. The more such actions that are possible, the more it makes sense to
build as a web _application_ instead of a web _site_.

~~~
adrianratnapala
They are a poor user experience because you don't want to have to load the
whole text for cases where the user is only supposed to see some of it at
first?

If so: then does it make sense to download megabytes of JS libraries in order
to save downloading 100kB of text?

~~~
sanderjd
That's not what I'm talking about. I'm talking about _actions_ a user is
taking. For instance, HN just performed a full page load for me to make this
comment, and will do another one after I click "reply", and then I'll have to
find my place again. That is sucky and would be much better implemented with
javascript and a background POST. This is somewhat ok on HN because actions
like commenting are much more rare than passively reading content (and because
I find enough value in the commentary here that I'm willing to put up with
quite a bit of suckiness), but it is a lot less ok for applications that are a
lot more behavior based.

To put it in concrete terms, I came to the conclusion that SPAs (or at least
using javascript to implement most behaviors on individual pages of a multi-
page application) make a ton of sense after spending a few years building an
internal line-of-business application with a lot of behavior and not much
content as a normal Rails multi-page app, noticing that the user experience
was not great at all, and finding it to have very low return on investment to
attempt to do it with progressive enhancement. We would have saved a lot of
time and money by starting with a JS-based SPA approach for an application
like that. If I were building a blog or news site, I suspect the opposite
would be true.

~~~
wtbob
> For instance, HN just performed a full page load for me to make this
> comment, and will do another one after I click "reply", and then I'll have
> to find my place again.

That's why I comment in a new tab.

But yes, I see that as an example where JavaScript could improve an HTML page
— but that's no reason to make it impossible to use with JavaScript!

------
ashitlerferad
I wish progressive enhancement were more popular, but it is probably too late
for anyone to ever care about it.

~~~
afarrell
I care about it but I just feel so befuddled by CSS that I don't know where I
would begin to learn to do it. I've been hoping that I could find somewhere
that teaches a mental model of layout which doesn't feel like playing whack-a-
mole. However, I've spent 9 years of using HTML+CSS, had multiple discussions
with fellow engineers, and even asked an MDN technical writer. Everything I've
seen tells me that, "yep, CSS is just like that."

And so getting rid of JavaScript as a tool to make things work just doesn't
make sense.

Hopefully flexbox becomes more prolific.

~~~
allendoerfer
Sorry, but 9 years are definitely enough to learn CSS. If that is true, you
have experienced IE6, whose broken implementation helped nicely to understand
the underlying models.

~~~
Kenji
No, he's right. The browser incompatibilities are incredible. The devil lies
in the subtle things. Relative spacing and heights, absolute positions, divs
that have to line up, etc. As soon as you require precision on all browsers,
it becomes a nightmare. And a decade of HTML+CSS experience changes nothing
about that, unless you only go for the most simplistic website imaginable.

~~~
allendoerfer
The only real difference between Chrome and Firefox I notice regularly these
days are subpixel rounding, input + button positioning in Firefox and styling
of stuff like checkboxes, selects or radio buttons.

It is a pita, a few weeks ago I implemented a responsive design for a wine
website created from the company's print agency, who just vomitted layers upon
layers of images on the thing. Zero whitespace. Still it is nothing like it
was 10 years ago. IE6 with its float bug simply destroyed the whole layout.
Now it is more like "this button is 2px off in Firefox" or "here is some
whitespace in chrome".

~~~
Kenji
Just a few days ago, I noticed a bug in IE11 that destroyed a layout of a site
of mine that used absolute position on a div. It worked in Chrome, Firefox,
Edge and on mobile browsers. Things break just like in the 90's unless you
constrain yourself to a very small set of commands and topologies that are
guaranteed to work.

------
Flenser
_user’s company has a proxy that blocks some or all JavaScript_

This one bites me every day. Websites with their social button / analytics
scripts before the main feature JS become unusable if the 3rd party JS errors
or fails to load.

~~~
toyg
I'm pretty sure some sites ( _cough-BoingBoing-cough_ ) do it intentionally:
no tracking, no content.

------
guessmyname
Is progressive enhancement still possible nowadays? Considering how many
millennials choose JavaScript frameworks for most of their projects I suppose
not. It is very rare for me to find a website that works without JavaScript
enabled either because the website in itself is written with JavaScript
_(which by the way doesn 't sounds like a good idea, try that with Lynx)_ or
because they are using analytic services as dependencies for the rest of the
code.

~~~
zeveb
> Is progressive enhancement still possible nowadays?

It's certainly possible to write a site intending to progressively enhance it.
It's easy, even.

It's not possible for end users to rely on it existing, because as you note
lazy, sloppy developers don't bother.

I prefer to light a candle _and_ curse the darkness.

------
muzster
This is quite progressive for the government.

think of all the savings for the government - no need to update old hardware
sitting in the schools, libraries, Councils etc...

------
dajonker
If anything this is a great example of what being agile is about. Start with
the bare essentials and slowly add features, without breaking the
characteristics that make the website nice to use such as speed and
reliability.

------
jsingleton
Here's the original post that explains how they got the numbers:
[https://gds.blog.gov.uk/2013/10/21/how-many-people-are-
missi...](https://gds.blog.gov.uk/2013/10/21/how-many-people-are-missing-out-
on-javascript-enhancement)

Looks like this was removed after a few years:
[https://github.com/alphagov/frontend/pull/944](https://github.com/alphagov/frontend/pull/944)

I'd like to see the data over that period and see what the JS stats are like
today.

~~~
robin_reala
We’re working on revamping and rerunning the test, will hopefully have new
data before the end of the year.

------
mtberatwork
One small quibble, if you are going to take the time to implement progressive
enhancement, why serve up incredibly large images?[1] Even sitting on a MBP
with a high speed connection, the initial download took some time from across
the pond.

[1] [https://gdstechnology.blog.gov.uk/wp-
content/uploads/sites/3...](https://gdstechnology.blog.gov.uk/wp-
content/uploads/sites/31/2016/09/28825249152_cd35912c3c_o.jpg)

~~~
robin_reala
Oops. I’ll see if I can get that fixed.

------
OJFord
I tweeted recently to say how I'd wanted to give some good feedback to
@GDSteam, and the beta feedback link redirected me to a localhost URL.

I hoped this would be a quick and pleasant interaction, but - and I really
should have guessed it - the Twitter 'operator' was clearly so far removed
from the developer that can quickly fix it.

~~~
joelanman
I work at GDS - that sounds broken, can you let me know where that link to
localhost is?

~~~
jamiegreen
I love that someone from GDS is here in the comments and cares enough to
follow up on something like this. You guys do a great job. I hope this
attitude exists across government departments!

~~~
toyg
I'm just back from this year's PyCon UK. There were quite a few GDS people
there, they've attended for several years now in increasing numbers. All good
geeks doing good work (and recruiting!).

~~~
OJFord

        > and recruiting!
    

When I looked previously it seemed the department was hiring only for short-
term contracts?

Which worries me a bit if that's the case - I think it's fantastic what and
how they're doing it, but not if the philosophy is "ship it and forget".

~~~
robin_reala
Nope, go to
[https://www.civilservicejobs.service.gov.uk/](https://www.civilservicejobs.service.gov.uk/)
and put Government Digital Service into the organisation field. We’re
currently recruiting developers / senior developers and web ops. No pure
front-end developers at the moment though.

Re short term contracts, we hire for two year contracts but it’s not explained
well that it’s trivial to extend those. We’re also trying to make roles
permanent as well in general.

~~~
nikon
do you hire contractors, too?

~~~
robin_reala
We do, although that doesn’t go through a central system and is on a team by
team basis. If you’re interested get hold of me on Twitter and I’ll see if I
can point you in the right direction.

------
manigandham
The giant 1MB image in this post should be fixed, goes against the rest of the
principles.

------
xchaotic
This may not go down too well, but it is an opinion I heard and I personally
agree with (having worked in UK gov institution and that far from GDS): GDS is
wasting taxpayer money, spending way too much attention on minute details like
apostrophes, CSS and stuff. Given that most of *.gov.uk are standardised now,
it works out to literally millions of GBP per line of CSS. In an ideal world
we'd have fully accessible web, progressive enhancement, responsive layouts
etc, but any real business has to say stop - this does not improve our
services that much anymore, whereas GDS are free to to redesign their CSS over
and over, just because no one else in the government understands technology.

~~~
forloop
> GDS is wasting taxpayer money, spending way too much attention on minute
> details like apostrophes, CSS and stuff.

You're getting downvoted because everyone already knows governments waste
taxpayers' money—thus your comment is redundant.

