Single page applications–GOV.UK

September 30, 2024

Do not build your service as a single-page application (SPA). This is where the loading of pages within your service is handled by JavaScript, rather than the browser.

Single page applications rarely bring benefits and can make the service inaccessible because:

  • users of assistive technology would be unaware of changes in context, for example when moving to a new page
  • it would fail to handle focus when moving between pages
  • the user would be unable to navigate using the back or forward buttons in their browser
  • users would be unable to recover from an error, for example if there is an interruption to their network connection

Recently we posted Thoughtwork’s advice on the SPA architecture–

Too often, though, we don’t see teams making that trade-off analysis, blindly accepting the complexity of SPAs by default even when the business needs don’t justify it. Indeed, we’ve started to notice that many newer developers aren’t even aware of an alternative approach, as they’ve spent their entire career in a framework like React. We believe that many websites will benefit from the simplicity of server-side logic, and we’re encouraged by techniques like Hotwire that help close the gap on user experience.

The UK Government Digital Service is even more direct–at least in their advice to folks developing government digital services. “Do not build your service as a single-page application