Skip to content

Instantly share code, notes, and snippets.

@hannalaakso
hannalaakso / gist:998d7c4aa0124366cd7cef79fa57b7e6
Last active July 14, 2020 16:31
Document how to configure Content Security Policy (CSP) to work with the inline 'js-enabled' script

Background

We currently have an inline script tag in the page template that adds the 'js-enabled' class

<script>
    document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');
  </script>

This is for usability reasons: we don't want to have to wait for the GOV.UK Frontend JS file to load before the correct classes and styling is applied - this approach avoids the flash of content for instance hiding the toggleable content of details and accordion components.

@hannalaakso
hannalaakso / accordion.js
Created August 29, 2018 14:17
Restructured accordion.js
/*
Accordion
This allows a collection of sections to be collapsed by default,
showing only their headers. Sections can be exanded or collapsed
individually by clicking their headers. An "Open all" button is
also added to the top of the accordion, which switches to "Close all"
when all the sections are expanded.
@hannalaakso
hannalaakso / gist:d758b0a45f90da89b6123e390c713462
Last active July 10, 2018 16:52
Suggestions for future "accessible-autocomplete" work

Findings from a phone call with Ed Horsford on 10th July 2018:

  1. govuk-country-and-territory-autocomplete should remain its own repo as much of the logic is specific to country data (more specific notes made about the workings of that repo).

  2. We should make it easy for depts to consume accessible-autocomplete while adding their own data / logic to it.

  3. We should add the following (in this order of priority?) to accessible-autocomplete:

  • Sorting (what would be an example of this?)
  • Synonyms (for instance on typing "gb", render "United Kingdom (GB)")
  • Typos (replace mistyped word with correct word)
@hannalaakso
hannalaakso / document-govuk-fe-in-govuk-ds.md
Last active October 30, 2018 14:31
Audit the Design System to see what in GOV.UK Frontend has not been documented there
@hannalaakso
hannalaakso / README.md
Created June 15, 2018 10:55
Accessibility for README

Support for assistive technology

GOV.UK Frontend will allow you to build services that comply with the guidance in the Service Manual.

Currently, GOV.UK Frontend officially supports the following assistive technology:

Software Version Type Browser
JAWS 15 or later screen reader Internet Explorer 11
## Support for assistive technology
GOV.UK Frontend will allow you to build services that comply with the [guidance
in the Service Manual](service-manual-assistive-technologies).
Currently, GOV.UK Frontend officially supports the following assistive technology:
| Software | Version | Type | Browser |
|--------------------------|----------------|--------------------|--------------------------|
| JAWS | 15 or later | screen reader | Internet Explorer 11 |

Accessibility criteria for Modal Dialog - WIP

User story

As an Assistive Technology (AT) user, I want to be informed that a modal dialog has opened, what its purpose is, and how to action / close it.

Acceptance criteria

The modal dialog must:

JS:
var notes = [];
var key = "webDesignerNotes";
window.onload = function() {
var submitButton = document.getElementById("submit");
submitButton.onclick = createNote;
if (!window.localStorage) {
alert("The Web Storage API is not supported.");