Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve accessibility of details component by polyfilling only where the native element is not available #1523

Merged
merged 5 commits into from
Aug 28, 2019

Conversation

NickColley
Copy link
Contributor

@NickColley NickColley commented Aug 6, 2019

This change simplifies the polyfilling we do for details to only polyfill if the browser does not support the native details element.

I have tested this in many different variations of assistive technologies and browsers and this seems to be a positive change.

iOS VoiceOver goes from: "help with nationality, button" to "help with nationality, collapsed"
"double tap to expand"

One arguably negative is that in JAWs you can no longer use aria-controls functionality to move to the summary details, but given that the content is right under the summary I don't think this would cause a barrier.

All this in mind, this feels like a really good future friendly change that'll allow GOV.UK Frontend to take advantage of native support for this element going forwards.

Thanks to @selfthinker for doing the initial research into this and proposing this change.

Full testing results

  JAWS 2018 + IE11 JAWS 2018 + Firefox 60 JAWS 2018 + Chrome 75 NVDA 2019 + IE11 NVDA 2019 + Firefox 60 NVDA 2019 + Chrome 75 VoiceOver + Safari 10.13.6 iOS 12.3.1 VoiceOver Dragon 13 + Firefox 60 Dragon 13 + Chrome 75
Current v3.0.0 "Help with nationality, button, collapsed"

👇press space

"Help with nationality, button, use JAWS KEY + alt + m to move to controlled element, expanded"
"Help with nationality, button, collapsed"

👇press space

"Help with nationality, button, use JAWS KEY + alt + m to move to controlled element, expanded"
"Help with nationality, button, collapsed"

👇press space

"expanded"

👇press space

"collapsed"
"button collapsed help with nationality"

👇press space

"expanded"

👇press space

"collapsed"
"help with nationality, button, collapsed"

👇press space

"help with nationality, button, expanded"
"button, collapsed, help with nationality"

👇press space

"expanded"

👇press space

"collapsed"
"help with nationality, button, main, collapsed"

👇press space

"help with nationality, button, expanded"
"help with nationality, button"

👇double tap

"help with nationality"

👇double tap

"help with nationality"
🗣️click Help with nationality

expands

🗣️click Help with nationality

collapses

🗣️click Help with nationality

expands

🗣️click Help with nationality

collapses

Proposed (native) "Help with nationality, button, collapsed"

👇press space

"Help with nationality, button, use JAWS KEY + alt + m to move to controlled element, expanded"
"Help with nationality, button, collapsed"

👇press space

"Help with nationality, button, expanded"
"Help with nationality, button, collapsed"

👇press space

"expanded"

👇press space

"collapsed"
"button collapsed help with nationality"

👇press space

"expanded"

👇press space

"collapsed"
"help with nationality, button, collapsed"

👇press space

"help with nationality, button, expanded"
"button, collapsed, help with nationality"

👇press space

"expanded"

👇press space

"collapsed"
"help with nationality, collapsed, summary, main"

👇press space

"help with nationality, expanded, summary, main"
"help with nationality, collapsed"
"double tap to expand"

👇double tap

"help with nationality"

👇double tap

"help with nationality"
🗣️click Help with nationality

expands

🗣️click Help with nationality

collapses

🗣️click Help with nationality

expands

🗣️click Help with nationality

collapses

CSV: https://gist.github.com/nickcolley/a44ac3bc94090f659f50082404b3961e

Resolves #988

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1523 August 6, 2019 12:06 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1523 August 7, 2019 17:31 Inactive
@NickColley
Copy link
Contributor Author

NickColley commented Aug 7, 2019

Running into issues where the polyfill doesnt behave the same with a native element as it would in an older browser, which makes me think maybe we should remove these tests since we don't have automated tests for polyfills elsewhere? 🤔

Can we be confident these tests actually represent what's happening on older browsers if they modify the result?

Perhaps we could make a test where we run the details component JavaScript on some fake elements like <test-details>...

@NickColley NickColley added this to Needs review in Design System Sprint Board via automation Aug 7, 2019
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1523 August 8, 2019 13:16 Inactive
@NickColley NickColley marked this pull request as ready for review August 8, 2019 14:08
*/
Details.prototype.destroy = function (node) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also removes destroy as it doesnt seem functional?

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1523 August 8, 2019 14:12 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1523 August 8, 2019 14:13 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1523 August 8, 2019 14:14 Inactive
@NickColley NickColley changed the title Simplify details polyfilling Improve accessibility of details component by polyfilling only where the native element is not available Aug 8, 2019
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1523 August 8, 2019 14:19 Inactive
// So we can run automated tests we need to be able to force the polyfill to run
var shouldForcePolyfill = typeof window.__GOVUKFRONTEND_FORCE_DETAILS_POLYFILL !== 'undefined'
// If there is native details support, we want to avoid running code to polyfill native behaviour.
var hasNativeDetails = typeof document.createElement('details').open === 'boolean'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory if we looked at this.$module.open instead of creating a details element we could avoid having to force the polyfill? 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that'd make sense…

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1523 August 8, 2019 14:38 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1523 August 8, 2019 14:39 Inactive
@NickColley
Copy link
Contributor Author

Tested this in IE8-11 and it's working as expected

}
}
})
if (!this.$module || hasNativeDetails) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this.$module is falsey, would we have already errored on line 20 when we tried to get the this.$module.open property? Wondering if we need to guard that right at the top of the function instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think this should be done too, good shout

} else {
$module.removeAttribute('open')
}
var hasOpenAttr = $module.getAttribute('open') !== null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do wonder what the benefit is of adding the open attribute to a non-native details element. It seems a bit strange, but I guess it might help some AT announce the state? 🤷‍♂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose if people have styled using the 'open' attribute?

details[open] p { color: red; }

@@ -5,130 +5,162 @@ const PORT = configPaths.ports.test

const baseUrl = 'http://localhost:' + PORT

describe('/components/details', () => {
describe('/components/details/preview', () => {
describe('details', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's worth adding a test that looks at the native details element (/components/details/preview) and asserts that it doesn't e.g. add all the aria attributes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this would check the feature detection works, good idea

@NickColley NickColley added this to the Next milestone Aug 28, 2019
This change simplifies the polyfilling we do for details to only polyfill if the browser does not support the native details element.

I have tested this in many different variations of assistive technologies and browsers and this seems to be a positive change.

iOS VoiceOver goes from: "help with nationality, button" to "help with nationality, collapsed"
"double tap to expand"

One arguably negative is that in JAWs you can no longer use aria-controls functionality to move to the summary details, but given that the content is right under the summary I don't think this would cause a barrier.

All this in mind, this feels like a really good future friendly change that'll allow GOV.UK Frontend to take advantage of native support for this element going forwards.
Since all JavaScript in this component is polyfill code by seperating this if we do add features to the details component that are not polyfill code in the future this'll give a clear distinction between the two.

This'll make deleting this code in the future easier as well.
Since we're running tests in an environment that has native support for the details element, we need to fake a lack of support by using an example with divs.
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1523 August 28, 2019 11:15 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1523 August 28, 2019 11:32 Inactive
Copy link
Member

@36degrees 36degrees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@NickColley NickColley merged commit a980a67 into master Aug 28, 2019
Design System Sprint Board automation moved this from Needs review to Done Aug 28, 2019
@NickColley NickColley deleted the simplify-details-polyfilling branch August 28, 2019 14:31
@36degrees 36degrees moved this from Done to Ready to release in Design System Sprint Board Aug 28, 2019
@NickColley NickColley mentioned this pull request Sep 2, 2019
@NickColley NickColley moved this from Ready to release to Done in Design System Sprint Board Sep 2, 2019
36degrees added a commit to alphagov/govuk-design-system that referenced this pull request Jul 21, 2022
I suspect this dates from when the polyfill for the `<details>` element used to be applied in all browsers, and added extra ARIA attributes which then needed to be kept in sync when this script toggled the open state.

However, since GOV.UK Frontend v3.1.0 the polyfill now does nothing in browsers that natively support the <details> elements [1].

This means that once these attributes are set on page load there is nothing to keep them in sync if the user toggles the details element:

- `aria-expanded` will always be `true`, potentially causing AT to announce the expanded state incorrectly
- `aria-hidden` will always be `false` – although this is likely not an issue as aria-hidden can't make things hidden using display:none 're-appear' in the accessibility tree

Instead, only toggle `aria-expanded` if it is already set on the element (which should only happen if the polyfill has run, in which case the browser does not natively support the `<details>` element).

[1]: alphagov/govuk-frontend#1523
36degrees added a commit to alphagov/govuk-design-system that referenced this pull request Jul 21, 2022
I believe this dates from when the polyfill for the `<details>` element used to be applied in all browsers, and added extra ARIA attributes which always needed to be kept in sync when this script toggled the open state.

However, since GOV.UK Frontend v3.1.0 the polyfill now does nothing in browsers that natively support the <details> elements [1].

This means that once these attributes are set on page load, unless the polyfill is running there is nothing to keep them in sync if the user toggles the details element:

- `aria-expanded` will always be `true`, potentially causing AT to announce the expanded state incorrectly
- `aria-hidden` will always be `false` – although this is likely not an issue as aria-hidden can't make things hidden using display:none 're-appear' in the accessibility tree

Instead, only toggle `aria-expanded` if it is already set on the element (which should only happen if the polyfill has run, in which case the browser does not natively support the `<details>` element).

We also need to re-introduce the `aria-hidden` attribute removed in 8b53583 as when the polyfill runs it currently adds an `aria-hidden` attribute which means the content inside the `<details>` element will be inaccessible even when opened unless we remove it.

Add a comment to try and explain why this code needs to exist.

[1]: alphagov/govuk-frontend#1523
ahosgood added a commit to LandRegistry/hmlr-design-system that referenced this pull request Aug 8, 2022
* Update Task List pattern to show it is being worked on

This aims to give people greater visibility over the work that is currently being done on this pattern and component.

Also updates the research section to add some additional known issues based on research gathered by the cross-government collaboration.

* Fix typo

Co-authored-by: Paul Hayes <fofr@users.noreply.github.com>

* Link homepage to Home Office Design System

* First draft

Co-Authored-By: Chris Hill-Scott <me@quis.cc>
Co-Authored-By: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Add new draft after working group review

* Refinements

Co-Authored-By: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Final review from team and working group

Co-Authored-By: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>
Co-Authored-By: EoinShaughnessy <72507742+EoinShaughnessy@users.noreply.github.com>

* Empty commit to kick off build

* Fix typo

* Add Ast to team list

* Update src/design-system-team.md.njk

Co-authored-by: Vanita Barrett-Smith <vanita.barrett@digital.cabinet-office.gov.uk>

* Changed field labels to 'Address line 1' and 'Address line 2'

This change did three things:
1. Stopped the second field label being invisible
2. Added 'optional' to second field label
3. Made the labels 'Address line 1' and 'Address line 2'

* Add message about co-design work

Fix HTML in status message instead of Markdown

Apply content tweak to message

Co-Authored-By: Chris Ballantine-Thomas <chris.ballantinethomas@digital.cabinet-office.gov.uk>

* Update for April 2021, new patterns

Minor tweak

Tweak

* address fieldset is now aligned with the new address fields

* Bump moment from 2.24.0 to 2.29.2

Bumps [moment](https://github.com/moment/moment) from 2.24.0 to 2.29.2.
- [Release notes](https://github.com/moment/moment/releases)
- [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
- [Commits](moment/moment@2.24.0...2.29.2)

---
updated-dependencies:
- dependency-name: moment
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update html label to text within macro

* Put county field back in address pattern and update guidance

* update image to generic journey on the check a service is suitable pattern page

* Bump urijs from 1.19.10 to 1.19.11

Bumps [urijs](https://github.com/medialize/URI.js) from 1.19.10 to 1.19.11.
- [Release notes](https://github.com/medialize/URI.js/releases)
- [Changelog](https://github.com/medialize/URI.js/blob/gh-pages/CHANGELOG.md)
- [Commits](medialize/URI.js@v1.19.10...v1.19.11)

---
updated-dependencies:
- dependency-name: urijs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Remove ƒ typo in fieldset example

* Fix autocomplete values in multiple address example

* Add latest blog posts April 2022

* Fix dashes and punctuation

* update image to make it neater on the check a service is suitable pattern page

* update image to make it neater on the check a service is suitable pattern page and compress it to save space

* Update Node to Active LTS version v16 (Gallium)

Node.js v14 has been in maintenance mode from 19 October 2021. v16 is the active LTS version.

This in turns updates NPM to v8, meaning our lockfile has change to [`lockfileVersion` 2](https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json#lockfileversion)

This is an internal change that affects development, testing and deployment.

* Add troubleshooting documentation for Node 16, node-sass and M1 machines

If a user has previously installed locally using Node 14 and lower on their M1 machine, they will encounter `node-sass` errors when running `npm install` after pulling this commit.

This adds documentation to deal with those errors.

This should only affect developers.

* Update metalsmith to latest version (2.4.2)

* Install @metalsmith/sass

* Uninstall metalsmith-sass and node-sass

We've installed @metalsmith/sass which uses sass (Dart Sass)
under the hood instead.

* Set `quietDeps` to true and move config to @metalsmith/sass syntax

Move the existing sass config to @metalsmith/sass syntax (uses loadPaths
instead of includePaths)

Set the `quietDeps` flag to true to suppress sass  deprecation warnings for
division (/) and any future deprecations coming from GOV.UK Frontend.

* Add 'src/stylesheets' to sass loadPaths

Dart Sass wasn't able to resolve the import for 'example-init', which
we use within our component example sass.

Telling it to look in 'src/stylesheets' to resolve imports, so it can find
this file.

* Remove node-sass on node v16 troubleshooting docs

We've updated Metalsmith and moved to Dart Sass, so this issue no longer applies (see alphagov#2150)

* Update link text in examples

This aims to make the difference between the `class` and the link text clearer, particularly for people relatively new to HTML.

* Add new team member

* Make help text advice clearer in fieldset guidance

* Add placeholder text info to text input guidance

* Revert town or city field to use address-level2

* Explain issues with client side validation

* Add implementation advice to skip link guidance

* Add subheadings to text input guidance

* Replace double quotes with singles in example

* Updating error example for National Insurance number to use correct format

* adding format guidance for National Insurance number

* Update design-system-team.md.njk

Added myself to the team member list

* Update src/design-system-team.md.njk

Co-authored-by: Kimberly Grey <kimberly.grey@digital.cabinet-office.gov.uk>

* Update src/patterns/national-insurance-numbers/index.md.njk

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Move #top anchor to before the skip link

The ‘back to top’ link takes users to the #top anchor point, which is currently before the navigation but after the ‘skip to main content’ link.

This means you can no longer skip past the navs etc (as per WCAG 2.1 2.4.1 Bypass Blocks [1]) unless you know to press shift + tab to go backwards in the tab order.

Insetead, we want the 'back to top' link to take the user to the very top of the page, so that the next tab will take them to ‘Skip to main content’ (or the cookie banner, if it’s not been dismissed).

We also considered taking the user to the start of `#main` [2], bypassing all of the navigation, but opted instead to move the `#top` anchor to be the very first thing because:

1. The back to top link was introduced in alphagov#687, when we moved from the side navigation and the main content being fixed, independently scrollable panes. This change meant that the side navigation no longer remained within the viewport.

It seems that the intent at the time was that the back to top link would bring the side navigation back into view, rather than providing a convenient way for the user to get back to the top of the main content.

2. Linking to #main makes it harder for users who have to get back to the navigation:

> If you're using a screen reader you could jump between landmarks using hot keys, but if you're just using a keyboard you're kinda just left with the tab key. Maybe I'm missing something, but the only options I could see to get back to the nav would be:
>
> - use TAB to go all the way through the content and footer content until you eventually get back to the top of the page
> - use back to top to get to the top of the main, and then use SHIFT+TAB to reverse through the nav menu
> - refresh the page and use TAB

3. We think users would expect to see the header when using the ‘Back to top’ link, especially if they were aiming for the navigation.

[1]: https://www.w3.org/TR/WCAG21/#bypass-blocks
[2]: alphagov#1561 (comment)

Closes alphagov#1561

* Make layout name consistent throughout guidance

* Update guidance on footer component

This proposed update:

- adds links to relevant information on privacy notices, cookie pages and accessibility statements
- clarifies copyright and licensing information

Related issues:

alphagov#1225
alphagov#1306

* Update character count guidance to match new implementation

* Minor edits for consistency

* Clarify and add accessibility information

* Update What's New section for v4.1.0

* Update roadmap

* Add context to JAWS issue

* Bump govuk-frontend to 4.1.0

* Add nodeListForEach helper directly into design system

The GOV.UK Frontend ES modules don't make the common (e.g: `nodeListForEach`)
function available to import. We've made this decision intentionally as we never
really intended for `nodeListForEach` to be something we provided.

This introduces a helper.js file which contains `nodeListForEach`. Switch our
JS files to use that helper, rather than the one from GOV.UK Frontend.

* Replace individual JS imports with ES modules initAll

* Explain that red border depends on exceeding limit

* Add accurate content for email field char limit

* Replace in guidance and examples

-  error message
 - textarea
 - text input
 - character count (including error example)

* Bump actions/setup-node from v2 to v3

* Use node-version-file input to specify node version

actions/setup-node v2.5.0 and above support reading a .nvmrc file itself [[1]].
This lets us simplify our code.

[1]: https://github.com/actions/setup-node/releases/tag/v2.5.0

* Make validation guidance language more consistent

* Add info on default components in page template

* Change contact panel headings to reflect the kind of page they're on

* Make link text in example reflect guidance

* Reorder link text

* Update team page on Design System site

* Update cookie hide button to be more descriptive

Change cookie button text from 'Hide this message' to
'Hide cookie message' to provide context to any users using
assistive tech navigating out of context.

* Add Claire to team page

* Fix em-dash

* Remove last line about performance platform

Remove last line on the Payment Card details page, which refers to the performance platform. This platform no longer exists.

* add a hint to the select to help users understand the options

* Bump govuk-frontend to v4.2.0

* Add guidance for pagination component

Iterate content and add headings for examples

Fix typo for heading level

Fix headings

Add guidance for pagination component

Iterate content and add headings for examples

Fix typo for heading level

Fix headings

Apply suggestions from tech writer review

Co-authored-by: EoinShaughnessy <72507742+EoinShaughnessy@users.noreply.github.com>

Update pagination guidance

Updated guidance to:

- cover issues raised by working group
- clarify use case for different types of pagination - and when to use 'continue' button and back link instead

Minor edits for dashes and contractions

Tweaking paragraph breaks

Remove section about saying "page" in labels

By default, "Previous" and "next" do not include "page" so this section is no longer needed

* Remove pagination component from community backlog

* Update what's new and roadmap for 4.2.0

* Update roadmap

Tidying up and reorganising some of our roadmap items in mid-2022.

* Fixed typo on pagination documentation

* Add paragraph tag to link example

This link example does not include a wrapping element, meaning that some of the text is appearing as default serif text instead of in Transport. As the text above this example states that it is
regarding links at the end of sentences or paragraphs, the example shouldn't be negatively affected by the inclusion of a paragraph.

* Indent Nunjucks code

Attempt to make this file easier to read by indenting Nunjucks code similarly to HTML.

* Refactor design system tabs JS

* Fix tab not being opened when macro options are linked to

* Update test ID and result checks

* Check for existence of tabs

* Update team member

Add Ben to the team

* Remove govuk-react-jsx which is no longer supported

* Bump terser from 5.7.0 to 5.14.2

Bumps [terser](https://github.com/terser/terser) from 5.7.0 to 5.14.2.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

---
updated-dependencies:
- dependency-name: terser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump moment from 2.29.2 to 2.29.4

Bumps [moment](https://github.com/moment/moment) from 2.29.2 to 2.29.4.
- [Release notes](https://github.com/moment/moment/releases)
- [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
- [Commits](moment/moment@2.29.2...2.29.4)

---
updated-dependencies:
- dependency-name: moment
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply `this` binding changes from code review

Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>

* Refactor getDesktopTab to not use a loop

* Bump metalsmith to 2.5.0

* Remove ‘mainstream’ from images guidance

Instead, define non-service content by content type and publishing method.

As flagged in alphagov/govuk-design-system-backlog#70 (comment):

> Mainstream is 2500 pages managed by GDS, but this guidance also applies to all content on www.gov.uk produced by depts, the half a million 'whitehall' pages.

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Use the official core metalsmith postcss plugin

Metalsmith is being updated fairly regularly now, and have an [official PostCSS plugin](https://github.com/metalsmith/postcss).

We've been blocked on bumping some dependencies because of this (alphagov#2016).

I've run `npm build` and there is one small prefixing change in the resulting CSS, but otherwise it's exactly the same.

* Only toggle details aria attributes if already set

I believe this dates from when the polyfill for the `<details>` element used to be applied in all browsers, and added extra ARIA attributes which always needed to be kept in sync when this script toggled the open state.

However, since GOV.UK Frontend v3.1.0 the polyfill now does nothing in browsers that natively support the <details> elements [1].

This means that once these attributes are set on page load, unless the polyfill is running there is nothing to keep them in sync if the user toggles the details element:

- `aria-expanded` will always be `true`, potentially causing AT to announce the expanded state incorrectly
- `aria-hidden` will always be `false` – although this is likely not an issue as aria-hidden can't make things hidden using display:none 're-appear' in the accessibility tree

Instead, only toggle `aria-expanded` if it is already set on the element (which should only happen if the polyfill has run, in which case the browser does not natively support the `<details>` element).

We also need to re-introduce the `aria-hidden` attribute removed in 8b53583 as when the polyfill runs it currently adds an `aria-hidden` attribute which means the content inside the `<details>` element will be inaccessible even when opened unless we remove it.

Add a comment to try and explain why this code needs to exist.

[1]: alphagov/govuk-frontend#1523

* Bump metalsmith-env to 2.2.0

- Allow storing the environment variables under a metadata[metadatakey] instead of metadata. See opts.metadatakey for more details.
- Dependency updates

* Use @metalsmith/in-place in favour of metalsmith-in-place

Core metalsmith plugin is effectively an updated version of the previous package.

v4.5.0

- feat: org migration, core plugin alignment
- feat: use metalsmith.match instead of multimatch, drop Node < 10 support
- feat: better jsdoc typehints & defaults mgmt
- fix: don't mistake dots in folder paths for extensions

* Use @metalsmith/layouts in favour of metalsmith-layouts

The core plugin replaces the old one.

v2.5.1
- pass the transformed list of files to metalsmith.match…
- Merge pull request alphagov#184 from doteco/master
- pass the transformed list of files to metalsmith.match so that renamed files can be matched

v2.5.0

- use metalsmith.match instead of multimatch
- Remove semicolons, run formatting. Remove devDependencies
- feat: add JSdocs, named plugin function
- Dependencies: updates debug to 4.3.4
- Drop Node < 12 support

2.4.0

- Return when done
- Improve readme
- Align dotfiles, repo with core plugin setup @metalsmith
- deps: update dependencies and fix prefer-object-spread

* Use @metalsmith/permalinks in favour of metalsmith-permalinks

Core plugin replaces old package.

Changelog: https://github.com/metalsmith/permalinks/blob/master/CHANGELOG.md

* Bump metalsmith-uglify to v2.4.1

Patch bump to update some dependencies.

* Bump @metalsmith/sass from 1.0.0 to 1.0.1

Changes: metalsmith/sass@1.0.0...1.0.1

* Adjust link text to GOV.UK image guidance

* Allow start buttons to be forms

Although unusual, there are a few valid circumstances where you might
want to submit a form when pressing the start button. A situation that
came up recently was we wanted to record analytics on when a user
started a service by recording the time that a user presses the start
button, without client-side JavaScript. The implementation for this
involved using the Rails `button_to` helper which generates a form which
POSTs to a route and includes a single `submit` button.

I think this is a valid use case of the start button, so I suggest
changing the wording on this to be slightly more open to the idea of
the start button not being a link.

* Update link to task list Sass file

This file has changed location in recent changes to the Prototype Kit, this updates the URL to no longer 404.

* Override auto-linking with period character

* Move width override classes from spacing to layout

Overriding the width of an element really has nothing to do with spacing, so this guidance make more sense as part of the layout guidance, alongside the documentation about the grid system which uses the same ‘one third’, ‘one half’ concepts.

* Tweak width override guidance for new context

Remove the link to the grid system which is now on the same page and is introduced before the override classes

Remove a reference to the spacing override classes which doesn’t make sense now that they’re on a separate page and the user might not have read about them already.

* Update links to width override classes

* Remove link to archived ethnic groups pattern

The ethnic groups pattern was archived in alphagov#1582.

* Remove broken link in page template guidance

The ‘variables’ and ‘blocks’ tables were merged in alphagov#1311 but this link was missed.

* Remove redundant classes

As noted in alphagov/govuk-frontend#2733, these classes don’t actually do anything.

* Remove extra closing `</tr>` tag

* Swap small and large screen sizes in spacing table

Putting the smaller sizes on the left-hand size seems more logical and fits better with a mobile-first approach.

* Flip order of spacing scale in table

Going from the smallest size to the largest size just makes more sense.

* Fix mismatched heading tags in navigation

* Document the static spacing scale

Fixes alphagov#1210.

* Improve headings for override classes and helpers

* Move section on overrides last

Try to encourage users who are writing their own CSS to use the helpers that we provide rather than the override classes, by making it more likely they’ll read about them first.

* Update link to my talk for more accessible blog

Allows more options to access it as I've made it into a blog post too.

* Tweaks to guidance on helpers

* Tweaks to guidance on override classes

* Bump autoprefixer to 10.4.7

One major version bump. Version 10:

- Uses PostCSS 8
- Removes support for Node.js 6, 8 and 11
- PostCSS is now a peerDependency

None of which affects our installation.

* Replace sass-lint with stylelint

* Add basic stylelint config

The resulting CSS appears to be the same after running `npm run build`.

* Fix SCSS linting errors

* Update documentation

* Replace metalsmith-tagcleaner with a custom marked renderer

* Bump marked and  jstransformer packages

Makes sense to bump these as part of this work, since they're being used under the hood to transform our files.

jstransformer-nunjucks Changelog: https://github.com/jstransformers/jstransformer-nunjucks/blob/master/CHANGELOG.md

- The major version bump simply adds the option to use custom Nunjucks loaders

jstransformer-marked Changelog: https://github.com/jstransformers/jstransformer-marked/blob/master/HISTORY.md

* Apply suggestions from code review

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Update logo in header to match GOV.UK Frontend

Mirror the changes that have been made to the Header component in GOV.UK Frontend [1] including:

- using conditional comments for header fallback PNG rather than an `<image` element [2]
- camel-casing the SVG attributes [3]

Fixes alphagov#2280.

[1]: https://github.com/alphagov/govuk-frontend/blob/aceb8d9798d8d2fc28357f1dda62d1a5e4a2eb98/src/govuk/components/header/template.njk
[2]: alphagov/govuk-frontend#2229
[3]: alphagov/govuk-frontend#1838

* Change to more up to date link

GSS appear to have moved to a new site - the link was pointing at the old (and out of date) archived standard.

* Remove examples for archived ethnic groups pattern

The ‘Ask users for ethnic groups’ pattern was archived in alphagov#1582 [1] (dd77104) when the guidance was moved into the ‘Ask users for equality information’ pattern.

New examples were created for the equality information pattern, but the existing examples and the SVG included in the guidance were not removed from the repo.

Remove the examples and the SVG previously included in the archived ethnic groups pattern.

[1]: alphagov#1582

* Use subclass for marked renderer

This better matches how things are done in Marked, and allows us to user `super` for cases other than images.

Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>

* Fix markdown lists on pagination component page

When there's no empty line before the list the Markdown renderer is
treating it like it's part of the preceding paragraph.

* Revert "Replace metalsmith-tagcleaner with a custom marked renderer"

* Update src/patterns/equality-information/index.md.njk

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* SCSS linting issue

Co-authored-by: Frankie Roberto <frankie@frankieroberto.com>
Co-authored-by: Paul Hayes <fofr@users.noreply.github.com>
Co-authored-by: EoinShaughnessy <eoin.shaughnessy@digital.cabinet-office.gov.uk>
Co-authored-by: EoinShaughnessy <72507742+EoinShaughnessy@users.noreply.github.com>
Co-authored-by: Chris Hill-Scott <me@quis.cc>
Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>
Co-authored-by: Chris Thomas <christopher.thomas@digital.cabinet-office.gov.uk>
Co-authored-by: Kimberly Grey <kimberly.grey@digital.cabinet-office.gov.uk>
Co-authored-by: Vanita Barrett-Smith <vanita.barrett@digital.cabinet-office.gov.uk>
Co-authored-by: terrysimpson99 <48089049+terrysimpson99@users.noreply.github.com>
Co-authored-by: Chris Ballantine-Thomas <chris.ballantinethomas@digital.cabinet-office.gov.uk>
Co-authored-by: Ciandelle Scollan <ciandelle.scollan@digital.cabinet-office.gov.uk>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ciandelle Scollan <100923629+Ciandelle@users.noreply.github.com>
Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>
Co-authored-by: domoscargin <brett.kyle@digital.cabinet-office.gov.uk>
Co-authored-by: ameliaphil <104211564+ameliaphil@users.noreply.github.com>
Co-authored-by: Colin Oakley <colin.oakley@engineering.digital.dwp.gov.uk>
Co-authored-by: Ruth Hammond <91464546+ruthhammond@users.noreply.github.com>
Co-authored-by: Colin <colin@htmlandbacon.com>
Co-authored-by: StephenGill <stephen.gill@digital.cabinet-office.gov.uk>
Co-authored-by: Laurence de Bruxelles <laurence.debruxelles@digital.cabinet-office.gov.uk>
Co-authored-by: CAAshworth <claire.ashworth@digital.cabinet-office.gov.uk>
Co-authored-by: owenatgov <owen.jones@digital.cabinet-office.gov.uk>
Co-authored-by: Robert Deniszczyc <72561986+robertdeniszczyc2@users.noreply.github.com>
Co-authored-by: NoraGDS <57447099+NoraGDS@users.noreply.github.com>
Co-authored-by: Andy Mantell <134642+andymantell@users.noreply.github.com>
Co-authored-by: Thomas Leese <thomas@leese.io>
Co-authored-by: Nick Colley <2445413+nickcolley@users.noreply.github.com>
Co-authored-by: Ed Horsford <mail@edwardhorsford.com>
Co-authored-by: Peter Yates <peter.yates@graphia.co.uk>
ahosgood added a commit to LandRegistry/hmlr-design-system that referenced this pull request Sep 1, 2022
* Remove ƒ typo in fieldset example

* Fix autocomplete values in multiple address example

* Add latest blog posts April 2022

* Fix dashes and punctuation

* update image to make it neater on the check a service is suitable pattern page

* update image to make it neater on the check a service is suitable pattern page and compress it to save space

* Update Node to Active LTS version v16 (Gallium)

Node.js v14 has been in maintenance mode from 19 October 2021. v16 is the active LTS version.

This in turns updates NPM to v8, meaning our lockfile has change to [`lockfileVersion` 2](https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json#lockfileversion)

This is an internal change that affects development, testing and deployment.

* Add troubleshooting documentation for Node 16, node-sass and M1 machines

If a user has previously installed locally using Node 14 and lower on their M1 machine, they will encounter `node-sass` errors when running `npm install` after pulling this commit.

This adds documentation to deal with those errors.

This should only affect developers.

* Update metalsmith to latest version (2.4.2)

* Install @metalsmith/sass

* Uninstall metalsmith-sass and node-sass

We've installed @metalsmith/sass which uses sass (Dart Sass)
under the hood instead.

* Set `quietDeps` to true and move config to @metalsmith/sass syntax

Move the existing sass config to @metalsmith/sass syntax (uses loadPaths
instead of includePaths)

Set the `quietDeps` flag to true to suppress sass  deprecation warnings for
division (/) and any future deprecations coming from GOV.UK Frontend.

* Add 'src/stylesheets' to sass loadPaths

Dart Sass wasn't able to resolve the import for 'example-init', which
we use within our component example sass.

Telling it to look in 'src/stylesheets' to resolve imports, so it can find
this file.

* Remove node-sass on node v16 troubleshooting docs

We've updated Metalsmith and moved to Dart Sass, so this issue no longer applies (see alphagov#2150)

* Update link text in examples

This aims to make the difference between the `class` and the link text clearer, particularly for people relatively new to HTML.

* Add new team member

* Make help text advice clearer in fieldset guidance

* Add placeholder text info to text input guidance

* Revert town or city field to use address-level2

* Explain issues with client side validation

* Add implementation advice to skip link guidance

* Add subheadings to text input guidance

* Replace double quotes with singles in example

* Updating error example for National Insurance number to use correct format

* adding format guidance for National Insurance number

* Update design-system-team.md.njk

Added myself to the team member list

* Update src/design-system-team.md.njk

Co-authored-by: Kimberly Grey <kimberly.grey@digital.cabinet-office.gov.uk>

* Update src/patterns/national-insurance-numbers/index.md.njk

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Move #top anchor to before the skip link

The ‘back to top’ link takes users to the #top anchor point, which is currently before the navigation but after the ‘skip to main content’ link.

This means you can no longer skip past the navs etc (as per WCAG 2.1 2.4.1 Bypass Blocks [1]) unless you know to press shift + tab to go backwards in the tab order.

Insetead, we want the 'back to top' link to take the user to the very top of the page, so that the next tab will take them to ‘Skip to main content’ (or the cookie banner, if it’s not been dismissed).

We also considered taking the user to the start of `#main` [2], bypassing all of the navigation, but opted instead to move the `#top` anchor to be the very first thing because:

1. The back to top link was introduced in alphagov#687, when we moved from the side navigation and the main content being fixed, independently scrollable panes. This change meant that the side navigation no longer remained within the viewport.

It seems that the intent at the time was that the back to top link would bring the side navigation back into view, rather than providing a convenient way for the user to get back to the top of the main content.

2. Linking to #main makes it harder for users who have to get back to the navigation:

> If you're using a screen reader you could jump between landmarks using hot keys, but if you're just using a keyboard you're kinda just left with the tab key. Maybe I'm missing something, but the only options I could see to get back to the nav would be:
>
> - use TAB to go all the way through the content and footer content until you eventually get back to the top of the page
> - use back to top to get to the top of the main, and then use SHIFT+TAB to reverse through the nav menu
> - refresh the page and use TAB

3. We think users would expect to see the header when using the ‘Back to top’ link, especially if they were aiming for the navigation.

[1]: https://www.w3.org/TR/WCAG21/#bypass-blocks
[2]: alphagov#1561 (comment)

Closes alphagov#1561

* Make layout name consistent throughout guidance

* Update guidance on footer component

This proposed update:

- adds links to relevant information on privacy notices, cookie pages and accessibility statements
- clarifies copyright and licensing information

Related issues:

alphagov#1225
alphagov#1306

* Update character count guidance to match new implementation

* Minor edits for consistency

* Clarify and add accessibility information

* Update What's New section for v4.1.0

* Update roadmap

* Add context to JAWS issue

* Bump govuk-frontend to 4.1.0

* Add nodeListForEach helper directly into design system

The GOV.UK Frontend ES modules don't make the common (e.g: `nodeListForEach`)
function available to import. We've made this decision intentionally as we never
really intended for `nodeListForEach` to be something we provided.

This introduces a helper.js file which contains `nodeListForEach`. Switch our
JS files to use that helper, rather than the one from GOV.UK Frontend.

* Replace individual JS imports with ES modules initAll

* Explain that red border depends on exceeding limit

* Add accurate content for email field char limit

* Replace in guidance and examples

-  error message
 - textarea
 - text input
 - character count (including error example)

* Bump actions/setup-node from v2 to v3

* Use node-version-file input to specify node version

actions/setup-node v2.5.0 and above support reading a .nvmrc file itself [[1]].
This lets us simplify our code.

[1]: https://github.com/actions/setup-node/releases/tag/v2.5.0

* Make validation guidance language more consistent

* Add info on default components in page template

* Change contact panel headings to reflect the kind of page they're on

* Make link text in example reflect guidance

* Reorder link text

* Update team page on Design System site

* Update cookie hide button to be more descriptive

Change cookie button text from 'Hide this message' to
'Hide cookie message' to provide context to any users using
assistive tech navigating out of context.

* Add Claire to team page

* Fix em-dash

* Remove last line about performance platform

Remove last line on the Payment Card details page, which refers to the performance platform. This platform no longer exists.

* add a hint to the select to help users understand the options

* Bump govuk-frontend to v4.2.0

* Add guidance for pagination component

Iterate content and add headings for examples

Fix typo for heading level

Fix headings

Add guidance for pagination component

Iterate content and add headings for examples

Fix typo for heading level

Fix headings

Apply suggestions from tech writer review

Co-authored-by: EoinShaughnessy <72507742+EoinShaughnessy@users.noreply.github.com>

Update pagination guidance

Updated guidance to:

- cover issues raised by working group
- clarify use case for different types of pagination - and when to use 'continue' button and back link instead

Minor edits for dashes and contractions

Tweaking paragraph breaks

Remove section about saying "page" in labels

By default, "Previous" and "next" do not include "page" so this section is no longer needed

* Remove pagination component from community backlog

* Update what's new and roadmap for 4.2.0

* Update roadmap

Tidying up and reorganising some of our roadmap items in mid-2022.

* Fixed typo on pagination documentation

* Add paragraph tag to link example

This link example does not include a wrapping element, meaning that some of the text is appearing as default serif text instead of in Transport. As the text above this example states that it is
regarding links at the end of sentences or paragraphs, the example shouldn't be negatively affected by the inclusion of a paragraph.

* Indent Nunjucks code

Attempt to make this file easier to read by indenting Nunjucks code similarly to HTML.

* Refactor design system tabs JS

* Fix tab not being opened when macro options are linked to

* Update test ID and result checks

* Check for existence of tabs

* Update team member

Add Ben to the team

* Remove govuk-react-jsx which is no longer supported

* Bump terser from 5.7.0 to 5.14.2

Bumps [terser](https://github.com/terser/terser) from 5.7.0 to 5.14.2.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

---
updated-dependencies:
- dependency-name: terser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump moment from 2.29.2 to 2.29.4

Bumps [moment](https://github.com/moment/moment) from 2.29.2 to 2.29.4.
- [Release notes](https://github.com/moment/moment/releases)
- [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
- [Commits](moment/moment@2.29.2...2.29.4)

---
updated-dependencies:
- dependency-name: moment
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply `this` binding changes from code review

Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>

* Refactor getDesktopTab to not use a loop

* Bump metalsmith to 2.5.0

* Remove ‘mainstream’ from images guidance

Instead, define non-service content by content type and publishing method.

As flagged in alphagov/govuk-design-system-backlog#70 (comment):

> Mainstream is 2500 pages managed by GDS, but this guidance also applies to all content on www.gov.uk produced by depts, the half a million 'whitehall' pages.

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Use the official core metalsmith postcss plugin

Metalsmith is being updated fairly regularly now, and have an [official PostCSS plugin](https://github.com/metalsmith/postcss).

We've been blocked on bumping some dependencies because of this (alphagov#2016).

I've run `npm build` and there is one small prefixing change in the resulting CSS, but otherwise it's exactly the same.

* Only toggle details aria attributes if already set

I believe this dates from when the polyfill for the `<details>` element used to be applied in all browsers, and added extra ARIA attributes which always needed to be kept in sync when this script toggled the open state.

However, since GOV.UK Frontend v3.1.0 the polyfill now does nothing in browsers that natively support the <details> elements [1].

This means that once these attributes are set on page load, unless the polyfill is running there is nothing to keep them in sync if the user toggles the details element:

- `aria-expanded` will always be `true`, potentially causing AT to announce the expanded state incorrectly
- `aria-hidden` will always be `false` – although this is likely not an issue as aria-hidden can't make things hidden using display:none 're-appear' in the accessibility tree

Instead, only toggle `aria-expanded` if it is already set on the element (which should only happen if the polyfill has run, in which case the browser does not natively support the `<details>` element).

We also need to re-introduce the `aria-hidden` attribute removed in 8b53583 as when the polyfill runs it currently adds an `aria-hidden` attribute which means the content inside the `<details>` element will be inaccessible even when opened unless we remove it.

Add a comment to try and explain why this code needs to exist.

[1]: alphagov/govuk-frontend#1523

* Bump metalsmith-env to 2.2.0

- Allow storing the environment variables under a metadata[metadatakey] instead of metadata. See opts.metadatakey for more details.
- Dependency updates

* Use @metalsmith/in-place in favour of metalsmith-in-place

Core metalsmith plugin is effectively an updated version of the previous package.

v4.5.0

- feat: org migration, core plugin alignment
- feat: use metalsmith.match instead of multimatch, drop Node < 10 support
- feat: better jsdoc typehints & defaults mgmt
- fix: don't mistake dots in folder paths for extensions

* Use @metalsmith/layouts in favour of metalsmith-layouts

The core plugin replaces the old one.

v2.5.1
- pass the transformed list of files to metalsmith.match…
- Merge pull request alphagov#184 from doteco/master
- pass the transformed list of files to metalsmith.match so that renamed files can be matched

v2.5.0

- use metalsmith.match instead of multimatch
- Remove semicolons, run formatting. Remove devDependencies
- feat: add JSdocs, named plugin function
- Dependencies: updates debug to 4.3.4
- Drop Node < 12 support

2.4.0

- Return when done
- Improve readme
- Align dotfiles, repo with core plugin setup @metalsmith
- deps: update dependencies and fix prefer-object-spread

* Use @metalsmith/permalinks in favour of metalsmith-permalinks

Core plugin replaces old package.

Changelog: https://github.com/metalsmith/permalinks/blob/master/CHANGELOG.md

* Bump metalsmith-uglify to v2.4.1

Patch bump to update some dependencies.

* Bump @metalsmith/sass from 1.0.0 to 1.0.1

Changes: metalsmith/sass@1.0.0...1.0.1

* Adjust link text to GOV.UK image guidance

* Allow start buttons to be forms

Although unusual, there are a few valid circumstances where you might
want to submit a form when pressing the start button. A situation that
came up recently was we wanted to record analytics on when a user
started a service by recording the time that a user presses the start
button, without client-side JavaScript. The implementation for this
involved using the Rails `button_to` helper which generates a form which
POSTs to a route and includes a single `submit` button.

I think this is a valid use case of the start button, so I suggest
changing the wording on this to be slightly more open to the idea of
the start button not being a link.

* Update link to task list Sass file

This file has changed location in recent changes to the Prototype Kit, this updates the URL to no longer 404.

* Override auto-linking with period character

* Move width override classes from spacing to layout

Overriding the width of an element really has nothing to do with spacing, so this guidance make more sense as part of the layout guidance, alongside the documentation about the grid system which uses the same ‘one third’, ‘one half’ concepts.

* Tweak width override guidance for new context

Remove the link to the grid system which is now on the same page and is introduced before the override classes

Remove a reference to the spacing override classes which doesn’t make sense now that they’re on a separate page and the user might not have read about them already.

* Update links to width override classes

* Remove link to archived ethnic groups pattern

The ethnic groups pattern was archived in alphagov#1582.

* Remove broken link in page template guidance

The ‘variables’ and ‘blocks’ tables were merged in alphagov#1311 but this link was missed.

* Remove redundant classes

As noted in alphagov/govuk-frontend#2733, these classes don’t actually do anything.

* Remove extra closing `</tr>` tag

* Swap small and large screen sizes in spacing table

Putting the smaller sizes on the left-hand size seems more logical and fits better with a mobile-first approach.

* Flip order of spacing scale in table

Going from the smallest size to the largest size just makes more sense.

* Fix mismatched heading tags in navigation

* Document the static spacing scale

Fixes alphagov#1210.

* Improve headings for override classes and helpers

* Move section on overrides last

Try to encourage users who are writing their own CSS to use the helpers that we provide rather than the override classes, by making it more likely they’ll read about them first.

* Update link to my talk for more accessible blog

Allows more options to access it as I've made it into a blog post too.

* Tweaks to guidance on helpers

* Tweaks to guidance on override classes

* Bump autoprefixer to 10.4.7

One major version bump. Version 10:

- Uses PostCSS 8
- Removes support for Node.js 6, 8 and 11
- PostCSS is now a peerDependency

None of which affects our installation.

* Replace sass-lint with stylelint

* Add basic stylelint config

The resulting CSS appears to be the same after running `npm run build`.

* Fix SCSS linting errors

* Update documentation

* Replace metalsmith-tagcleaner with a custom marked renderer

* Bump marked and  jstransformer packages

Makes sense to bump these as part of this work, since they're being used under the hood to transform our files.

jstransformer-nunjucks Changelog: https://github.com/jstransformers/jstransformer-nunjucks/blob/master/CHANGELOG.md

- The major version bump simply adds the option to use custom Nunjucks loaders

jstransformer-marked Changelog: https://github.com/jstransformers/jstransformer-marked/blob/master/HISTORY.md

* Apply suggestions from code review

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Update logo in header to match GOV.UK Frontend

Mirror the changes that have been made to the Header component in GOV.UK Frontend [1] including:

- using conditional comments for header fallback PNG rather than an `<image` element [2]
- camel-casing the SVG attributes [3]

Fixes alphagov#2280.

[1]: https://github.com/alphagov/govuk-frontend/blob/aceb8d9798d8d2fc28357f1dda62d1a5e4a2eb98/src/govuk/components/header/template.njk
[2]: alphagov/govuk-frontend#2229
[3]: alphagov/govuk-frontend#1838

* Document static spacing override classes

Static spacing override classes are being introduced to GOV.UK Frontend (alphagov/govuk-frontend#2672).

Document the new classes so that users know how they work, and how they compare to the existing responsive spacing override classes.

* Change to more up to date link

GSS appear to have moved to a new site - the link was pointing at the old (and out of date) archived standard.

* Remove examples for archived ethnic groups pattern

The ‘Ask users for ethnic groups’ pattern was archived in alphagov#1582 [1] (dd77104) when the guidance was moved into the ‘Ask users for equality information’ pattern.

New examples were created for the equality information pattern, but the existing examples and the SVG included in the guidance were not removed from the repo.

Remove the examples and the SVG previously included in the archived ethnic groups pattern.

[1]: alphagov#1582

* Use subclass for marked renderer

This better matches how things are done in Marked, and allows us to user `super` for cases other than images.

Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>

* Fix markdown lists on pagination component page

When there's no empty line before the list the Markdown renderer is
treating it like it's part of the preceding paragraph.

* Revert "Replace metalsmith-tagcleaner with a custom marked renderer"

* Update src/patterns/equality-information/index.md.njk

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Fix matchMedia event listener in IE / Safari < 14

IE 10/11 and Safari >= 5.1 < 14 support `window.matchMedia` but do not support `MediaQueryList.addEventListener`.

Instead we have to use the non-standard (and deprecated) `MediaQueryList.addListener`, which only takes one argument which is the callback function to run when the media query status changes [1].

Test for the presence of the `MediaQueryList.addEventListener` method and then use whichever method is appropriate for the browser.

[1]: https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener

Co-authored-by: Owen Jones <64783893+owenatgov@users.noreply.github.com>

* Enable aliases for section headings

* Alias section break as hr

* Update What's New for v4.3.0

* Update govuk-frontend to 4.3.0

* Document `opengraphImageUrl` page template option

Document the new `opengraphImageUrl` page template option, added in alphagov/govuk-frontend#2673.

Update the documentation for the `assetUrl` option to make it slightly more generic and remove the recommendation to override by adding another meta tag to the `head` block as users should use the new `opengraphImageUrl` instead.

* Retry failed tests

The "see no evil, hear no evil" approach. This does not address the flaky tests themselves, but sets `jest.retryTimes` to 3, rerunning failed tests and greatly increasing the likelihood of a CI test task passing.

This is speedier (and more automatic) than rerunning a full CI task again, so might be enough if the flakiness isn't easily addressable.

* Fix linting issues

* Update team members list

* Reference cookie banner in updating guidance

We now have a cookie banner component, so we should link to it from this guide.

* Add ‘measuring the value’ talk to community page

* Update what's new with DSDay blog post

Tweak line breaks to look better

Add full stop

* Update date

Co-authored-by: NoraGDS <57447099+NoraGDS@users.noreply.github.com>

* Shorten call-to-action

* Update what's new for v4.3.1

* Update to GOV.UK Frontend v4.3.1

* Add in link and download to Mural file

Interaction Designer, Clare Brown (clare.brown@digital.hmrc.gov.uk) has created an editable Mural template of GOV.UK Design System Flow Diagram for all designers to use.

This will help designers map out their service and/or user journeys at a high-level. The template is based off designs that were created in Miro and hosted on GitHub which can be found here: https://github.com/paulmsmith/govuk-designsystem-flow-diagram-miro.

File needs to be hosted for download, uploaded and have instructions on how people can use the file.

* Remove unused tables option

The `tables` option was removed in Marked v0.7.0 [1] so this doesn’t do anything any more.

[1]: https://github.com/markedjs/marked/releases/tag/v0.7.0

* Remove unused gfm: true from marked config

The documentation for the `pedantic` option [1] says:

> If true, conform to the original markdown.pl as much as possible. Don't fix original markdown bugs or behavior. Turns off and overrides gfm.

Verified that this option is doing nothing by comparing the build output with and without this setting, and there is no difference (other than the obfuscated email address on the community page, which is non-deterministic and so changes with every build):

```
$ diff -r deploy/public-marked-main deploy/public
diff -r deploy/public-marked-main/community/design-system-working-group/index.html deploy/public/community/design-system-working-group/index.html
1045c1045
< <p>In the meantime, if you are interested in joining the working group email the Design System team at <a href="mailto:&alphagov#103;&alphagov#111;&#x76;&alphagov#117;&#x6b;&#x2d;&#x64;&alphagov#101;&alphagov#115;&alphagov#105;&#x67;&alphagov#110;&#x2d;&alphagov#115;&#x79;&alphagov#115;&alphagov#116;&alphagov#101;&#x6d;&#x2d;&alphagov#115;&#x75;&#x70;&#x70;&#x6f;&alphagov#114;&#x74;&#x40;&#100;&#x69;&#x67;&alphagov#105;&alphagov#116;&#97;&#x6c;&#46;&#99;&#x61;&#x62;&alphagov#105;&alphagov#110;&alphagov#101;&#x74;&#45;&#x6f;&#x66;&#x66;&alphagov#105;&#99;&#x65;&#46;&alphagov#103;&#x6f;&#x76;&#x2e;&alphagov#117;&#x6b;">&alphagov#103;&alphagov#111;&#x76;&alphagov#117;&#x6b;&#x2d;&#x64;&alphagov#101;&alphagov#115;&alphagov#105;&#x67;&alphagov#110;&#x2d;&alphagov#115;&#x79;&alphagov#115;&alphagov#116;&alphagov#101;&#x6d;&#x2d;&alphagov#115;&#x75;&#x70;&#x70;&#x6f;&alphagov#114;&#x74;&#x40;&#100;&#x69;&#x67;&alphagov#105;&alphagov#116;&#97;&#x6c;&#46;&#99;&#x61;&#x62;&alphagov#105;&alphagov#110;&alphagov#101;&#x74;&#45;&#x6f;&#x66;&#x66;&alphagov#105;&#99;&#x65;&#46;&alphagov#103;&#x6f;&#x76;&#x2e;&alphagov#117;&#x6b;</a>.</p>
---
> <p>In the meantime, if you are interested in joining the working group email the Design System team at <a href="mailto:&#x67;&alphagov#111;&alphagov#118;&alphagov#117;&#x6b;&#x2d;&#100;&alphagov#101;&#x73;&alphagov#105;&alphagov#103;&#x6e;&#45;&alphagov#115;&#x79;&#x73;&alphagov#116;&alphagov#101;&alphagov#109;&#x2d;&alphagov#115;&#x75;&alphagov#112;&alphagov#112;&#x6f;&alphagov#114;&alphagov#116;&#x40;&#100;&alphagov#105;&#x67;&alphagov#105;&alphagov#116;&#97;&#x6c;&#x2e;&#x63;&#97;&#x62;&#x69;&alphagov#110;&alphagov#101;&alphagov#116;&#x2d;&#x6f;&alphagov#102;&alphagov#102;&#x69;&#99;&#x65;&#46;&alphagov#103;&alphagov#111;&alphagov#118;&#x2e;&alphagov#117;&alphagov#107;">&#x67;&alphagov#111;&alphagov#118;&alphagov#117;&#x6b;&#x2d;&#100;&alphagov#101;&#x73;&alphagov#105;&alphagov#103;&#x6e;&#45;&alphagov#115;&#x79;&#x73;&alphagov#116;&alphagov#101;&alphagov#109;&#x2d;&alphagov#115;&#x75;&alphagov#112;&alphagov#112;&#x6f;&alphagov#114;&alphagov#116;&#x40;&#100;&alphagov#105;&#x67;&alphagov#105;&alphagov#116;&#97;&#x6c;&#x2e;&#x63;&#97;&#x62;&#x69;&alphagov#110;&alphagov#101;&alphagov#116;&#x2d;&#x6f;&alphagov#102;&alphagov#102;&#x69;&#99;&#x65;&#46;&alphagov#103;&alphagov#111;&alphagov#118;&#x2e;&alphagov#117;&alphagov#107;</a>.</p>
```

[1]: https://marked.js.org/using_advanced#options

* Add border to 'preview' / 'archive' banner

We moved the banner when refactoring the nav in 2b6a27b.

Now that the banner is not between the header and the navigation, it makes sense to add the bottom border back to separate the banner from the page content.

Keep the `--no-border` modifier which we use on the homepage when the banner is followed immediately by the masthead.

* Remove redundant app-pane wrapper

When the Design System had an independently scrollable nav and body regions, we used a 'app-pane' flexbox wrapper around the whole site so that the header could be fixed in place above both scrollable regions.

When we simplified the layout and lost the indepedantly scrollable regions we didn't tidy up the wrapper, which isn't really doing anything any more (other than the flex layout causing weird issues like the banner width issue seen in 6c83fde).

Remove the unneccesary wrapper and its classes.

* Remove custom phase banner styles

The `width: 100%` is no longer needed that we're not in a flex context and can be removed.

As it turns out, the margins are being overridden by the `app-width-container` class anyway – and if they weren't being overriden, they'd mean that the phase banner would be flush up against the viewport edges on mobile, which isn't what we want.

* Remove redundant app-pane__content wrappers

The `app-pane__content` class isn't doing anything useful in these layouts and can be removed.

* Split 'category nav' out from app pane CSS

This doesn't really have anything to do with the rest of the 'split pane' CSS, so split it out into its own 'component'.

Whilst we're at it, give it a better name and some context to help explain what it's for and why we need it.

* Rename app-pane classes

* Fix implementation for non-flexbox browsers

* Rename 'pane' to 'split-pane'

* Remove unused CSS

* Stop recommending pattern=[0-9]* on number inputs

We previously recommended using `pattern="[0-9]*"` on number inputs to prompt iOS to display the numeric keypad.

This has been unnecessary since Safari 12.2, when support for the standardised `inputmode` attribute was added to Safari.

We stopped using the `pattern` attribute on the date input component [1] in v4.1.0 (released in May 2022) as the proportion of GOV.UK visitors using versions of iOS 12.x and below had fallen to 0.08% of total traffic.

[1]: alphagov/govuk-frontend#2599

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Remove pattern attribute from examples

See previous commit for details.

* Remove use of govuk-exports

We need to use govuk-exports in GOV.UK Frontend as files can be imported multiple files but we only ever want the CSS to be outputted once.

As we're in control of how and where Sass in the Design System is imported, we don't need to worry about this and don't need to use the exports function.

* Remove Sass and class that don't do anything

* Fix more Sass that doesn't do anything

The govuk-visually-hidden has `position: absolute` marked as `!important` and therefore it overrides this, so it can't be doing anything.

* Remove unused app-phase-banner class

* Update package-lock.json

* Remove new GOV.UK pages

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: christopherthomasdesign <chris.ballantinethomas@digital.cabinet-office.gov.uk>
Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>
Co-authored-by: Ciandelle Scollan <ciandelle.scollan@digital.cabinet-office.gov.uk>
Co-authored-by: Ciandelle Scollan <100923629+Ciandelle@users.noreply.github.com>
Co-authored-by: domoscargin <brett.kyle@digital.cabinet-office.gov.uk>
Co-authored-by: Vanita Barrett <vanita.barrett@digital.cabinet-office.gov.uk>
Co-authored-by: Frankie Roberto <frankie@frankieroberto.com>
Co-authored-by: ameliaphil <104211564+ameliaphil@users.noreply.github.com>
Co-authored-by: EoinShaughnessy <eoin.shaughnessy@digital.cabinet-office.gov.uk>
Co-authored-by: EoinShaughnessy <72507742+EoinShaughnessy@users.noreply.github.com>
Co-authored-by: Colin Oakley <colin.oakley@engineering.digital.dwp.gov.uk>
Co-authored-by: Ruth Hammond <91464546+ruthhammond@users.noreply.github.com>
Co-authored-by: Kimberly Grey <kimberly.grey@digital.cabinet-office.gov.uk>
Co-authored-by: Colin <colin@htmlandbacon.com>
Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>
Co-authored-by: StephenGill <stephen.gill@digital.cabinet-office.gov.uk>
Co-authored-by: Laurence de Bruxelles <laurence.debruxelles@digital.cabinet-office.gov.uk>
Co-authored-by: CAAshworth <claire.ashworth@digital.cabinet-office.gov.uk>
Co-authored-by: owenatgov <owen.jones@digital.cabinet-office.gov.uk>
Co-authored-by: Robert Deniszczyc <72561986+robertdeniszczyc2@users.noreply.github.com>
Co-authored-by: NoraGDS <57447099+NoraGDS@users.noreply.github.com>
Co-authored-by: Andy Mantell <134642+andymantell@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Thomas Leese <thomas@leese.io>
Co-authored-by: Nick Colley <2445413+nickcolley@users.noreply.github.com>
Co-authored-by: Ed Horsford <mail@edwardhorsford.com>
Co-authored-by: Peter Yates <peter.yates@graphia.co.uk>
Co-authored-by: Owen Jones <64783893+owenatgov@users.noreply.github.com>
Co-authored-by: Nick Colley <nick.colley@hippodigital.co.uk>
Co-authored-by: Clare Brown <107033520+clare-brown@users.noreply.github.com>
ahosgood added a commit to LandRegistry/hmlr-design-system that referenced this pull request Nov 9, 2022
* V1 (#1)

* Updates to package.json

* Change brand colour and typeface, remove crown

* Change all repo URLs from alphagov to LandRegistry

* README title update

* Remove crown from footer

* Phase banner added

* HMLR-specific views

* HMLR-specific CSS

* Custom HMLR HTML and CSS

* Simpler header

* Procfile added

* GOV.UK -> HMLR

* Small content update

* GOV.UK -> HMLR

* GOV.UK -> HMLR

* Added example accessibility section

* Add Umami tracking

* Add HMLR favicon

* Comment out cookie banner

* Updated guidelines regarding typography

* added advice for casework

* Added initial CODEOWNERS

* Update CODEOWNERS

* initial content for styles, components and patterns (#5)

* remove unneccessary pages except typography

* temporary template for sections with no subnav

* styles advice and temprary template for hiding subnav

* syles help

* components and patterns landing pages

* clarify who to speak to

* Updated getting started page  (#6)

* Started work on 'Get Started' section

* Updated content in Getting Started Page

Co-authored-by: AJ <andrew.hosgood@landregistry.gov.uk>

* Added content to accessibilty section (#4)

* Created new legal requirements page

* new page

* new page to contact me

* Added new Assisted Digital content

* Intro to accessibility page changes

* What you can do page changes

* accessibility page changes

* added new page and content

* Content added to accessibility new page

* New content added

* added links and text

* rearranged content

* updating content and links

* links added

* links added

* links added

* new page and links

* edited changes

* edited pages

* Case change

* Remove dash

* Moved a11y index page to root of dir

* Fixed content, removed MS Word encoded characters

* Fixed link

* deleted contact me

Co-authored-by: Gaynor Williams <gaynor.williams@landregistry.gov.uk>

* Update the Design System Steering Group list (#7)

* Updated list of Design System team members

* Removed the GDS code owners

* Add James to the list of steering group members

* Include more pages in search

* Remove deploy folder

* Update canonical and sitemap URLs

* Update icons

* Remove deploy action

* Fixed SCSS style

* General site updates (#8)

* Fixed layout for no-nav page

* Update a11y statement

* Update cookie page

* Update get in touch page

* "GOV.UK Design System" -> "HMLR Design System"

* A11y statement links

* Update homepage

* Update community pages

* Removed all component sub pages

* Removed all pattern sub pages

* Update link on error page

* Get started prototyping page cleaned down

* Styles page to show nav to typography

* Non-nav pages don't need navigation logic

* Contact links

* What's new updated

* Disable cookie banner

* Fix tests and temporarily disable unwanted tests

* Temporary emails

* Added more pages to accessibility (#10)

* Created new legal requirements page

* new page

* new page to contact me

* Added new Assisted Digital content

* Intro to accessibility page changes

* What you can do page changes

* accessibility page changes

* added new page and content

* Content added to accessibility new page

* New content added

* added links and text

* rearranged content

* updating content and links

* links added

* links added

* links added

* new page and links

* edited changes

* edited pages

* Case change

* Remove dash

* Moved a11y index page to root of dir

* Fixed content, removed MS Word encoded characters

* Fixed link

* deleted contact me

* updated and split content over more pages

* Created more pages and added links

* updated logical order of alphabetical

* deleted page what more you can do

* added 1 word

* AT page content added

* AT page updated

* AT changes

* added text to link to accessibility checklist

* Capital T for Heading

* unneccesary capitals and 1 spelling mistake

* new line added

* Upper case at start of sentence.

* Update src/accessibility/videos-and-recordings/index.md.njk

Co-authored-by: Andrew Hosgood <mail@andrewhosgood.com>

* resolved conversations

Co-authored-by: AJ <andrew.hosgood@landregistry.gov.uk>
Co-authored-by: Andrew Hosgood <mail@andrewhosgood.com>

* Fixing updates from upstream

* Banner for merge requests

* New footer

* Use the GDS phase banner

* Use pull request number in phase banner

* Phase banner links

* Content/getting started (#14)

* Started work on 'Get Started' section

* Updated content in Getting Started Page

* Getting started changes 25.3.22

* Updates

* Case fix

Co-authored-by: Adam Flay <adam.flay@landregistry.gov.uk>

* Content/accessibility (#13)

* Created new legal requirements page

* new page

* new page to contact me

* Added new Assisted Digital content

* Intro to accessibility page changes

* What you can do page changes

* accessibility page changes

* added new page and content

* Content added to accessibility new page

* New content added

* added links and text

* rearranged content

* updating content and links

* links added

* links added

* links added

* new page and links

* edited changes

* edited pages

* Case change

* Remove dash

* Moved a11y index page to root of dir

* Fixed content, removed MS Word encoded characters

* Fixed link

* deleted contact me

* updated and split content over more pages

* Created more pages and added links

* updated logical order of alphabetical

* deleted page what more you can do

* added 1 word

* AT page content added

* AT page updated

* AT changes

* added text to link to accessibility checklist

* Capital T for Heading

* unneccesary capitals and 1 spelling mistake

* new line added

* Upper case at start of sentence.

* Update src/accessibility/videos-and-recordings/index.md.njk

Co-authored-by: Andrew Hosgood <mail@andrewhosgood.com>

* resolved conversations

* deleted 1 line

* added in 90 to 100

* new link added to disproportionate burden

* space added per AJs comment

* full stop added

* added text re marking images

* More info added to accessibility statement page

* full stop removed

* 1 word deleted

* My changes are not reflected in the design system

* AJs suggestions added

* brackets and fullstop amended

* brackets

Co-authored-by: AJ <andrew.hosgood@landregistry.gov.uk>
Co-authored-by: Andrew Hosgood <mail@andrewhosgood.com>

* Update more references to GDS

* Fixed links page

* Code tidy

* Code tidy

* Added accessibility checklist

* Remove upload artifact step from action

* Remove artifact variables from action

* Update intro to accessibility checklist

* AT -> assistive technologies

* Update design system team email (#16)

* Previous design system explanation (#15)

* Previous design system explanation

* Update link text

* Fix spelling mistake

* Remove duplicated content (#17)

* Fix/duplicated getting started content (#18)

* Remove duplicated content

* Re-insert feedback into getting started section

* Addressing comment r.e. getting started links

* Addressing comment r.e. getting started feedback

* Content/content guidelines (#21)

* Adding a new content section

* content pages added to design system

* Re-introduce includeInSearch

* WIP: Change to Nunjucks accordion template

* from html to nunjucks, h2 and description amends

* Added missing space in page markup

* Remove second import line

Co-authored-by: AJ <andrew.hosgood@landregistry.gov.uk>

* Don't run tests in Windows (#23)

* Remove link to x-Gov HMLR Slack channel (#20)

* Remove analytics for launch (#19)

* Feature/upstream changes (#22)

* Update Task List pattern to show it is being worked on

This aims to give people greater visibility over the work that is currently being done on this pattern and component.

Also updates the research section to add some additional known issues based on research gathered by the cross-government collaboration.

* Fix typo

Co-authored-by: Paul Hayes <fofr@users.noreply.github.com>

* Link homepage to Home Office Design System

* First draft

Co-Authored-By: Chris Hill-Scott <me@quis.cc>
Co-Authored-By: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Add new draft after working group review

* Refinements

Co-Authored-By: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Final review from team and working group

Co-Authored-By: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>
Co-Authored-By: EoinShaughnessy <72507742+EoinShaughnessy@users.noreply.github.com>

* Empty commit to kick off build

* Fix typo

* Add Ast to team list

* Update src/design-system-team.md.njk

Co-authored-by: Vanita Barrett-Smith <vanita.barrett@digital.cabinet-office.gov.uk>

* Changed field labels to 'Address line 1' and 'Address line 2'

This change did three things:
1. Stopped the second field label being invisible
2. Added 'optional' to second field label
3. Made the labels 'Address line 1' and 'Address line 2'

* Add message about co-design work

Fix HTML in status message instead of Markdown

Apply content tweak to message

Co-Authored-By: Chris Ballantine-Thomas <chris.ballantinethomas@digital.cabinet-office.gov.uk>

* Update for April 2021, new patterns

Minor tweak

Tweak

* address fieldset is now aligned with the new address fields

* Bump moment from 2.24.0 to 2.29.2

Bumps [moment](https://github.com/moment/moment) from 2.24.0 to 2.29.2.
- [Release notes](https://github.com/moment/moment/releases)
- [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/moment/moment/compare/2.24.0...2.29.2)

---
updated-dependencies:
- dependency-name: moment
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update html label to text within macro

* Put county field back in address pattern and update guidance

* update image to generic journey on the check a service is suitable pattern page

* Bump urijs from 1.19.10 to 1.19.11

Bumps [urijs](https://github.com/medialize/URI.js) from 1.19.10 to 1.19.11.
- [Release notes](https://github.com/medialize/URI.js/releases)
- [Changelog](https://github.com/medialize/URI.js/blob/gh-pages/CHANGELOG.md)
- [Commits](https://github.com/medialize/URI.js/compare/v1.19.10...v1.19.11)

---
updated-dependencies:
- dependency-name: urijs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Remove ƒ typo in fieldset example

* Fix autocomplete values in multiple address example

* Add latest blog posts April 2022

* Fix dashes and punctuation

* update image to make it neater on the check a service is suitable pattern page

* update image to make it neater on the check a service is suitable pattern page and compress it to save space

* Update Node to Active LTS version v16 (Gallium)

Node.js v14 has been in maintenance mode from 19 October 2021. v16 is the active LTS version.

This in turns updates NPM to v8, meaning our lockfile has change to [`lockfileVersion` 2](https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json#lockfileversion)

This is an internal change that affects development, testing and deployment.

* Add troubleshooting documentation for Node 16, node-sass and M1 machines

If a user has previously installed locally using Node 14 and lower on their M1 machine, they will encounter `node-sass` errors when running `npm install` after pulling this commit.

This adds documentation to deal with those errors.

This should only affect developers.

* Update metalsmith to latest version (2.4.2)

* Install @metalsmith/sass

* Uninstall metalsmith-sass and node-sass

We've installed @metalsmith/sass which uses sass (Dart Sass)
under the hood instead.

* Set `quietDeps` to true and move config to @metalsmith/sass syntax

Move the existing sass config to @metalsmith/sass syntax (uses loadPaths
instead of includePaths)

Set the `quietDeps` flag to true to suppress sass  deprecation warnings for
division (/) and any future deprecations coming from GOV.UK Frontend.

* Add 'src/stylesheets' to sass loadPaths

Dart Sass wasn't able to resolve the import for 'example-init', which
we use within our component example sass.

Telling it to look in 'src/stylesheets' to resolve imports, so it can find
this file.

* Remove node-sass on node v16 troubleshooting docs

We've updated Metalsmith and moved to Dart Sass, so this issue no longer applies (see https://github.com/alphagov/govuk-design-system/pull/2150)

* Add new team member

* Make help text advice clearer in fieldset guidance

* Add placeholder text info to text input guidance

* Revert town or city field to use address-level2

* Explain issues with client side validation

* Add implementation advice to skip link guidance

* Add subheadings to text input guidance

* Replace double quotes with singles in example

* Updating error example for National Insurance number to use correct format

* adding format guidance for National Insurance number

* Update design-system-team.md.njk

Added myself to the team member list

* Update src/design-system-team.md.njk

Co-authored-by: Kimberly Grey <kimberly.grey@digital.cabinet-office.gov.uk>

* Update src/patterns/national-insurance-numbers/index.md.njk

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Move #top anchor to before the skip link

The ‘back to top’ link takes users to the #top anchor point, which is currently before the navigation but after the ‘skip to main content’ link.

This means you can no longer skip past the navs etc (as per WCAG 2.1 2.4.1 Bypass Blocks [1]) unless you know to press shift + tab to go backwards in the tab order.

Insetead, we want the 'back to top' link to take the user to the very top of the page, so that the next tab will take them to ‘Skip to main content’ (or the cookie banner, if it’s not been dismissed).

We also considered taking the user to the start of `#main` [2], bypassing all of the navigation, but opted instead to move the `#top` anchor to be the very first thing because:

1. The back to top link was introduced in #687, when we moved from the side navigation and the main content being fixed, independently scrollable panes. This change meant that the side navigation no longer remained within the viewport.

It seems that the intent at the time was that the back to top link would bring the side navigation back into view, rather than providing a convenient way for the user to get back to the top of the main content.

2. Linking to #main makes it harder for users who have to get back to the navigation:

> If you're using a screen reader you could jump between landmarks using hot keys, but if you're just using a keyboard you're kinda just left with the tab key. Maybe I'm missing something, but the only options I could see to get back to the nav would be:
>
> - use TAB to go all the way through the content and footer content until you eventually get back to the top of the page
> - use back to top to get to the top of the main, and then use SHIFT+TAB to reverse through the nav menu
> - refresh the page and use TAB

3. We think users would expect to see the header when using the ‘Back to top’ link, especially if they were aiming for the navigation.

[1]: https://www.w3.org/TR/WCAG21/#bypass-blocks
[2]: https://github.com/alphagov/govuk-design-system/issues/1561#issuecomment-964273009

Closes #1561

* Make layout name consistent throughout guidance

* Update guidance on footer component

This proposed update:

- adds links to relevant information on privacy notices, cookie pages and accessibility statements
- clarifies copyright and licensing information

Related issues:

https://github.com/alphagov/govuk-design-system/issues/1225
https://github.com/alphagov/govuk-design-system/issues/1306

* Update character count guidance to match new implementation

* Minor edits for consistency

* Clarify and add accessibility information

* Update What's New section for v4.1.0

* Update roadmap

* Add context to JAWS issue

* Bump govuk-frontend to 4.1.0

* Add nodeListForEach helper directly into design system

The GOV.UK Frontend ES modules don't make the common (e.g: `nodeListForEach`)
function available to import. We've made this decision intentionally as we never
really intended for `nodeListForEach` to be something we provided.

This introduces a helper.js file which contains `nodeListForEach`. Switch our
JS files to use that helper, rather than the one from GOV.UK Frontend.

* Replace individual JS imports with ES modules initAll

* Explain that red border depends on exceeding limit

* Add accurate content for email field char limit

* Replace in guidance and examples

-  error message
 - textarea
 - text input
 - character count (including error example)

* Bump actions/setup-node from v2 to v3

* Use node-version-file input to specify node version

actions/setup-node v2.5.0 and above support reading a .nvmrc file itself [[1]].
This lets us simplify our code.

[1]: https://github.com/actions/setup-node/releases/tag/v2.5.0

* Make validation guidance language more consistent

* Remove patterns

* Update package-lock.json

* Remove GDS community text

Co-authored-by: Frankie Roberto <frankie@frankieroberto.com>
Co-authored-by: Paul Hayes <fofr@users.noreply.github.com>
Co-authored-by: EoinShaughnessy <eoin.shaughnessy@digital.cabinet-office.gov.uk>
Co-authored-by: EoinShaughnessy <72507742+EoinShaughnessy@users.noreply.github.com>
Co-authored-by: Chris Hill-Scott <me@quis.cc>
Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>
Co-authored-by: Chris Thomas <christopher.thomas@digital.cabinet-office.gov.uk>
Co-authored-by: Kimberly Grey <kimberly.grey@digital.cabinet-office.gov.uk>
Co-authored-by: Vanita Barrett-Smith <vanita.barrett@digital.cabinet-office.gov.uk>
Co-authored-by: terrysimpson99 <48089049+terrysimpson99@users.noreply.github.com>
Co-authored-by: Chris Ballantine-Thomas <chris.ballantinethomas@digital.cabinet-office.gov.uk>
Co-authored-by: Ciandelle Scollan <ciandelle.scollan@digital.cabinet-office.gov.uk>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ciandelle Scollan <100923629+Ciandelle@users.noreply.github.com>
Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>
Co-authored-by: domoscargin <brett.kyle@digital.cabinet-office.gov.uk>
Co-authored-by: ameliaphil <104211564+ameliaphil@users.noreply.github.com>
Co-authored-by: Colin Oakley <colin.oakley@engineering.digital.dwp.gov.uk>
Co-authored-by: Ruth Hammond <91464546+ruthhammond@users.noreply.github.com>
Co-authored-by: Colin <colin@htmlandbacon.com>
Co-authored-by: StephenGill <stephen.gill@digital.cabinet-office.gov.uk>
Co-authored-by: Laurence de Bruxelles <laurence.debruxelles@digital.cabinet-office.gov.uk>

* Updated URL

* HMLR Open Graph logo

* Content tweaks to HMLR accessibility statement (#24)

* Refactor accessibility section (#25)

* patterns homepage first draft (#26)

* add table to the components page to match patterns page (#27)

Co-authored-by: lruser <lruser@AT252095.local>

* Ensure contact panel is visible in all sections (#28)

* Add link to GDS alternative text (#29)

* "HMLR" -> "HM Land Registry" (#30)

* HMLR -> HM Land Registry

* Site header name

* "alternative text" links to page anchor

* Content/component page styling (#31)

* update content on styles front page

* update page content based on design system review. Change way we describe designers who work on casework systems, use bullet point guidelines, add HM to Land Registry in relevant places, ensure consistency across the interaction design sections, update any references to Gov to GOV.UK

Co-authored-by: lruser <lruser@AT252095.local>

* Content/review and improve (#32)

* homepage content

* get started - tell people what the design practice design guidance is

* homepage correctly say Land Registry

* styles page clearer

* typography imporved

* remove Help imporve this page form all pages in site

* full width table for pattern backlog

* components table full width

* Content/consistency review (#33)

* conssitency review on designers who work on casework systems, and actvie voice on typography page

* join 2 sentences in bullet point with a '-' and hyphenate front-end as being used as an adjective

* make way we say 'more than 1' service in component and backlog  tables consistent - remove ';' and replace with 'and' for readability. Switch order of LLC and SFLAPI around to aid readability

* fix typo in 'what's new section on homepage

Co-authored-by: lruser <lruser@AT252095.local>

* Updated assistive technologies info (#34)

* Remove component/pattern tables, add backlog details (#53)

* Change advice for typography (#52)

* Closes #51

* Start advice for Geo typeface

* Geo typography draft

* If you need a copy

* Updated details on Geo typeface - fixes #49

* Lint fixes

* Update Geo example

Co-authored-by: Adam Flay <adam.flay@landregistry.gov.uk>

* Updates from GDS (#55)

* Update Task List pattern to show it is being worked on

This aims to give people greater visibility over the work that is currently being done on this pattern and component.

Also updates the research section to add some additional known issues based on research gathered by the cross-government collaboration.

* Fix typo

Co-authored-by: Paul Hayes <fofr@users.noreply.github.com>

* Link homepage to Home Office Design System

* First draft

Co-Authored-By: Chris Hill-Scott <me@quis.cc>
Co-Authored-By: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Add new draft after working group review

* Refinements

Co-Authored-By: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Final review from team and working group

Co-Authored-By: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>
Co-Authored-By: EoinShaughnessy <72507742+EoinShaughnessy@users.noreply.github.com>

* Empty commit to kick off build

* Fix typo

* Add Ast to team list

* Update src/design-system-team.md.njk

Co-authored-by: Vanita Barrett-Smith <vanita.barrett@digital.cabinet-office.gov.uk>

* Changed field labels to 'Address line 1' and 'Address line 2'

This change did three things:
1. Stopped the second field label being invisible
2. Added 'optional' to second field label
3. Made the labels 'Address line 1' and 'Address line 2'

* Add message about co-design work

Fix HTML in status message instead of Markdown

Apply content tweak to message

Co-Authored-By: Chris Ballantine-Thomas <chris.ballantinethomas@digital.cabinet-office.gov.uk>

* Update for April 2021, new patterns

Minor tweak

Tweak

* address fieldset is now aligned with the new address fields

* Bump moment from 2.24.0 to 2.29.2

Bumps [moment](https://github.com/moment/moment) from 2.24.0 to 2.29.2.
- [Release notes](https://github.com/moment/moment/releases)
- [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/moment/moment/compare/2.24.0...2.29.2)

---
updated-dependencies:
- dependency-name: moment
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update html label to text within macro

* Put county field back in address pattern and update guidance

* update image to generic journey on the check a service is suitable pattern page

* Bump urijs from 1.19.10 to 1.19.11

Bumps [urijs](https://github.com/medialize/URI.js) from 1.19.10 to 1.19.11.
- [Release notes](https://github.com/medialize/URI.js/releases)
- [Changelog](https://github.com/medialize/URI.js/blob/gh-pages/CHANGELOG.md)
- [Commits](https://github.com/medialize/URI.js/compare/v1.19.10...v1.19.11)

---
updated-dependencies:
- dependency-name: urijs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Remove ƒ typo in fieldset example

* Fix autocomplete values in multiple address example

* Add latest blog posts April 2022

* Fix dashes and punctuation

* update image to make it neater on the check a service is suitable pattern page

* update image to make it neater on the check a service is suitable pattern page and compress it to save space

* Update Node to Active LTS version v16 (Gallium)

Node.js v14 has been in maintenance mode from 19 October 2021. v16 is the active LTS version.

This in turns updates NPM to v8, meaning our lockfile has change to [`lockfileVersion` 2](https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json#lockfileversion)

This is an internal change that affects development, testing and deployment.

* Add troubleshooting documentation for Node 16, node-sass and M1 machines

If a user has previously installed locally using Node 14 and lower on their M1 machine, they will encounter `node-sass` errors when running `npm install` after pulling this commit.

This adds documentation to deal with those errors.

This should only affect developers.

* Update metalsmith to latest version (2.4.2)

* Install @metalsmith/sass

* Uninstall metalsmith-sass and node-sass

We've installed @metalsmith/sass which uses sass (Dart Sass)
under the hood instead.

* Set `quietDeps` to true and move config to @metalsmith/sass syntax

Move the existing sass config to @metalsmith/sass syntax (uses loadPaths
instead of includePaths)

Set the `quietDeps` flag to true to suppress sass  deprecation warnings for
division (/) and any future deprecations coming from GOV.UK Frontend.

* Add 'src/stylesheets' to sass loadPaths

Dart Sass wasn't able to resolve the import for 'example-init', which
we use within our component example sass.

Telling it to look in 'src/stylesheets' to resolve imports, so it can find
this file.

* Remove node-sass on node v16 troubleshooting docs

We've updated Metalsmith and moved to Dart Sass, so this issue no longer applies (see https://github.com/alphagov/govuk-design-system/pull/2150)

* Update link text in examples

This aims to make the difference between the `class` and the link text clearer, particularly for people relatively new to HTML.

* Add new team member

* Make help text advice clearer in fieldset guidance

* Add placeholder text info to text input guidance

* Revert town or city field to use address-level2

* Explain issues with client side validation

* Add implementation advice to skip link guidance

* Add subheadings to text input guidance

* Replace double quotes with singles in example

* Updating error example for National Insurance number to use correct format

* adding format guidance for National Insurance number

* Update design-system-team.md.njk

Added myself to the team member list

* Update src/design-system-team.md.njk

Co-authored-by: Kimberly Grey <kimberly.grey@digital.cabinet-office.gov.uk>

* Update src/patterns/national-insurance-numbers/index.md.njk

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Move #top anchor to before the skip link

The ‘back to top’ link takes users to the #top anchor point, which is currently before the navigation but after the ‘skip to main content’ link.

This means you can no longer skip past the navs etc (as per WCAG 2.1 2.4.1 Bypass Blocks [1]) unless you know to press shift + tab to go backwards in the tab order.

Insetead, we want the 'back to top' link to take the user to the very top of the page, so that the next tab will take them to ‘Skip to main content’ (or the cookie banner, if it’s not been dismissed).

We also considered taking the user to the start of `#main` [2], bypassing all of the navigation, but opted instead to move the `#top` anchor to be the very first thing because:

1. The back to top link was introduced in #687, when we moved from the side navigation and the main content being fixed, independently scrollable panes. This change meant that the side navigation no longer remained within the viewport.

It seems that the intent at the time was that the back to top link would bring the side navigation back into view, rather than providing a convenient way for the user to get back to the top of the main content.

2. Linking to #main makes it harder for users who have to get back to the navigation:

> If you're using a screen reader you could jump between landmarks using hot keys, but if you're just using a keyboard you're kinda just left with the tab key. Maybe I'm missing something, but the only options I could see to get back to the nav would be:
>
> - use TAB to go all the way through the content and footer content until you eventually get back to the top of the page
> - use back to top to get to the top of the main, and then use SHIFT+TAB to reverse through the nav menu
> - refresh the page and use TAB

3. We think users would expect to see the header when using the ‘Back to top’ link, especially if they were aiming for the navigation.

[1]: https://www.w3.org/TR/WCAG21/#bypass-blocks
[2]: https://github.com/alphagov/govuk-design-system/issues/1561#issuecomment-964273009

Closes #1561

* Make layout name consistent throughout guidance

* Update guidance on footer component

This proposed update:

- adds links to relevant information on privacy notices, cookie pages and accessibility statements
- clarifies copyright and licensing information

Related issues:

https://github.com/alphagov/govuk-design-system/issues/1225
https://github.com/alphagov/govuk-design-system/issues/1306

* Update character count guidance to match new implementation

* Minor edits for consistency

* Clarify and add accessibility information

* Update What's New section for v4.1.0

* Update roadmap

* Add context to JAWS issue

* Bump govuk-frontend to 4.1.0

* Add nodeListForEach helper directly into design system

The GOV.UK Frontend ES modules don't make the common (e.g: `nodeListForEach`)
function available to import. We've made this decision intentionally as we never
really intended for `nodeListForEach` to be something we provided.

This introduces a helper.js file which contains `nodeListForEach`. Switch our
JS files to use that helper, rather than the one from GOV.UK Frontend.

* Replace individual JS imports with ES modules initAll

* Explain that red border depends on exceeding limit

* Add accurate content for email field char limit

* Replace in guidance and examples

-  error message
 - textarea
 - text input
 - character count (including error example)

* Bump actions/setup-node from v2 to v3

* Use node-version-file input to specify node version

actions/setup-node v2.5.0 and above support reading a .nvmrc file itself [[1]].
This lets us simplify our code.

[1]: https://github.com/actions/setup-node/releases/tag/v2.5.0

* Make validation guidance language more consistent

* Add info on default components in page template

* Change contact panel headings to reflect the kind of page they're on

* Make link text in example reflect guidance

* Reorder link text

* Update team page on Design System site

* Update cookie hide button to be more descriptive

Change cookie button text from 'Hide this message' to
'Hide cookie message' to provide context to any users using
assistive tech navigating out of context.

* Add Claire to team page

* Fix em-dash

* Remove last line about performance platform

Remove last line on the Payment Card details page, which refers to the performance platform. This platform no longer exists.

* add a hint to the select to help users understand the options

* Bump govuk-frontend to v4.2.0

* Add guidance for pagination component

Iterate content and add headings for examples

Fix typo for heading level

Fix headings

Add guidance for pagination component

Iterate content and add headings for examples

Fix typo for heading level

Fix headings

Apply suggestions from tech writer review

Co-authored-by: EoinShaughnessy <72507742+EoinShaughnessy@users.noreply.github.com>

Update pagination guidance

Updated guidance to:

- cover issues raised by working group
- clarify use case for different types of pagination - and when to use 'continue' button and back link instead

Minor edits for dashes and contractions

Tweaking paragraph breaks

Remove section about saying "page" in labels

By default, "Previous" and "next" do not include "page" so this section is no longer needed

* Remove pagination component from community backlog

* Update what's new and roadmap for 4.2.0

* Update roadmap

Tidying up and reorganising some of our roadmap items in mid-2022.

* Fixed typo on pagination documentation

* Add paragraph tag to link example

This link example does not include a wrapping element, meaning that some of the text is appearing as default serif text instead of in Transport. As the text above this example states that it is
regarding links at the end of sentences or paragraphs, the example shouldn't be negatively affected by the inclusion of a paragraph.

* Indent Nunjucks code

Attempt to make this file easier to read by indenting Nunjucks code similarly to HTML.

* Refactor design system tabs JS

* Fix tab not being opened when macro options are linked to

* Update test ID and result checks

* Check for existence of tabs

* Update team member

Add Ben to the team

* Remove govuk-react-jsx which is no longer supported

* Bump terser from 5.7.0 to 5.14.2

Bumps [terser](https://github.com/terser/terser) from 5.7.0 to 5.14.2.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

---
updated-dependencies:
- dependency-name: terser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump moment from 2.29.2 to 2.29.4

Bumps [moment](https://github.com/moment/moment) from 2.29.2 to 2.29.4.
- [Release notes](https://github.com/moment/moment/releases)
- [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/moment/moment/compare/2.29.2...2.29.4)

---
updated-dependencies:
- dependency-name: moment
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply `this` binding changes from code review

Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>

* Refactor getDesktopTab to not use a loop

* Bump metalsmith to 2.5.0

* Remove ‘mainstream’ from images guidance

Instead, define non-service content by content type and publishing method.

As flagged in https://github.com/alphagov/govuk-design-system-backlog/issues/70#issuecomment-1187335536:

> Mainstream is 2500 pages managed by GDS, but this guidance also applies to all content on www.gov.uk produced by depts, the half a million 'whitehall' pages.

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Use the official core metalsmith postcss plugin

Metalsmith is being updated fairly regularly now, and have an [official PostCSS plugin](https://github.com/metalsmith/postcss).

We've been blocked on bumping some dependencies because of this (#2016).

I've run `npm build` and there is one small prefixing change in the resulting CSS, but otherwise it's exactly the same.

* Only toggle details aria attributes if already set

I believe this dates from when the polyfill for the `<details>` element used to be applied in all browsers, and added extra ARIA attributes which always needed to be kept in sync when this script toggled the open state.

However, since GOV.UK Frontend v3.1.0 the polyfill now does nothing in browsers that natively support the <details> elements [1].

This means that once these attributes are set on page load, unless the polyfill is running there is nothing to keep them in sync if the user toggles the details element:

- `aria-expanded` will always be `true`, potentially causing AT to announce the expanded state incorrectly
- `aria-hidden` will always be `false` – although this is likely not an issue as aria-hidden can't make things hidden using display:none 're-appear' in the accessibility tree

Instead, only toggle `aria-expanded` if it is already set on the element (which should only happen if the polyfill has run, in which case the browser does not natively support the `<details>` element).

We also need to re-introduce the `aria-hidden` attribute removed in 8b53583 as when the polyfill runs it currently adds an `aria-hidden` attribute which means the content inside the `<details>` element will be inaccessible even when opened unless we remove it.

Add a comment to try and explain why this code needs to exist.

[1]: https://github.com/alphagov/govuk-frontend/pull/1523

* Bump metalsmith-env to 2.2.0

- Allow storing the environment variables under a metadata[metadatakey] instead of metadata. See opts.metadatakey for more details.
- Dependency updates

* Use @metalsmith/in-place in favour of metalsmith-in-place

Core metalsmith plugin is effectively an updated version of the previous package.

v4.5.0

- feat: org migration, core plugin alignment
- feat: use metalsmith.match instead of multimatch, drop Node < 10 support
- feat: better jsdoc typehints & defaults mgmt
- fix: don't mistake dots in folder paths for extensions

* Use @metalsmith/layouts in favour of metalsmith-layouts

The core plugin replaces the old one.

v2.5.1
- pass the transformed list of files to metalsmith.match…
- Merge pull request #184 from doteco/master
- pass the transformed list of files to metalsmith.match so that renamed files can be matched

v2.5.0

- use metalsmith.match instead of multimatch
- Remove semicolons, run formatting. Remove devDependencies
- feat: add JSdocs, named plugin function
- Dependencies: updates debug to 4.3.4
- Drop Node < 12 support

2.4.0

- Return when done
- Improve readme
- Align dotfiles, repo with core plugin setup @metalsmith
- deps: update dependencies and fix prefer-object-spread

* Use @metalsmith/permalinks in favour of metalsmith-permalinks

Core plugin replaces old package.

Changelog: https://github.com/metalsmith/permalinks/blob/master/CHANGELOG.md

* Bump metalsmith-uglify to v2.4.1

Patch bump to update some dependencies.

* Bump @metalsmith/sass from 1.0.0 to 1.0.1

Changes: https://github.com/metalsmith/sass/compare/1.0.0...1.0.1

* Adjust link text to GOV.UK image guidance

* Allow start buttons to be forms

Although unusual, there are a few valid circumstances where you might
want to submit a form when pressing the start button. A situation that
came up recently was we wanted to record analytics on when a user
started a service by recording the time that a user presses the start
button, without client-side JavaScript. The implementation for this
involved using the Rails `button_to` helper which generates a form which
POSTs to a route and includes a single `submit` button.

I think this is a valid use case of the start button, so I suggest
changing the wording on this to be slightly more open to the idea of
the start button not being a link.

* Update link to task list Sass file

This file has changed location in recent changes to the Prototype Kit, this updates the URL to no longer 404.

* Override auto-linking with period character

* Move width override classes from spacing to layout

Overriding the width of an element really has nothing to do with spacing, so this guidance make more sense as part of the layout guidance, alongside the documentation about the grid system which uses the same ‘one third’, ‘one half’ concepts.

* Tweak width override guidance for new context

Remove the link to the grid system which is now on the same page and is introduced before the override classes

Remove a reference to the spacing override classes which doesn’t make sense now that they’re on a separate page and the user might not have read about them already.

* Update links to width override classes

* Remove link to archived ethnic groups pattern

The ethnic groups pattern was archived in #1582.

* Remove broken link in page template guidance

The ‘variables’ and ‘blocks’ tables were merged in #1311 but this link was missed.

* Remove redundant classes

As noted in https://github.com/alphagov/govuk-frontend/issues/2733, these classes don’t actually do anything.

* Remove extra closing `</tr>` tag

* Swap small and large screen sizes in spacing table

Putting the smaller sizes on the left-hand size seems more logical and fits better with a mobile-first approach.

* Flip order of spacing scale in table

Going from the smallest size to the largest size just makes more sense.

* Fix mismatched heading tags in navigation

* Document the static spacing scale

Fixes #1210.

* Improve headings for override classes and helpers

* Move section on overrides last

Try to encourage users who are writing their own CSS to use the helpers that we provide rather than the override classes, by making it more likely they’ll read about them first.

* Update link to my talk for more accessible blog

Allows more options to access it as I've made it into a blog post too.

* Tweaks to guidance on helpers

* Tweaks to guidance on override classes

* Bump autoprefixer to 10.4.7

One major version bump. Version 10:

- Uses PostCSS 8
- Removes support for Node.js 6, 8 and 11
- PostCSS is now a peerDependency

None of which affects our installation.

* Replace sass-lint with stylelint

* Add basic stylelint config

The resulting CSS appears to be the same after running `npm run build`.

* Fix SCSS linting errors

* Update documentation

* Replace metalsmith-tagcleaner with a custom marked renderer

* Bump marked and  jstransformer packages

Makes sense to bump these as part of this work, since they're being used under the hood to transform our files.

jstransformer-nunjucks Changelog: https://github.com/jstransformers/jstransformer-nunjucks/blob/master/CHANGELOG.md

- The major version bump simply adds the option to use custom Nunjucks loaders

jstransformer-marked Changelog: https://github.com/jstransformers/jstransformer-marked/blob/master/HISTORY.md

* Apply suggestions from code review

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Update logo in header to match GOV.UK Frontend

Mirror the changes that have been made to the Header component in GOV.UK Frontend [1] including:

- using conditional comments for header fallback PNG rather than an `<image` element [2]
- camel-casing the SVG attributes [3]

Fixes #2280.

[1]: https://github.com/alphagov/govuk-frontend/blob/aceb8d9798d8d2fc28357f1dda62d1a5e4a2eb98/src/govuk/components/header/template.njk
[2]: https://github.com/alphagov/govuk-frontend/pull/2229
[3]: https://github.com/alphagov/govuk-frontend/pull/1838

* Change to more up to date link

GSS appear to have moved to a new site - the link was pointing at the old (and out of date) archived standard.

* Remove examples for archived ethnic groups pattern

The ‘Ask users for ethnic groups’ pattern was archived in #1582 [1] (dd77104) when the guidance was moved into the ‘Ask users for equality information’ pattern.

New examples were created for the equality information pattern, but the existing examples and the SVG included in the guidance were not removed from the repo.

Remove the examples and the SVG previously included in the archived ethnic groups pattern.

[1]: https://github.com/alphagov/govuk-design-system/pull/1582

* Use subclass for marked renderer

This better matches how things are done in Marked, and allows us to user `super` for cases other than images.

Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>

* Fix markdown lists on pagination component page

When there's no empty line before the list the Markdown renderer is
treating it like it's part of the preceding paragraph.

* Revert "Replace metalsmith-tagcleaner with a custom marked renderer"

* Update src/patterns/equality-information/index.md.njk

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* SCSS linting issue

Co-authored-by: Frankie Roberto <frankie@frankieroberto.com>
Co-authored-by: Paul Hayes <fofr@users.noreply.github.com>
Co-authored-by: EoinShaughnessy <eoin.shaughnessy@digital.cabinet-office.gov.uk>
Co-authored-by: EoinShaughnessy <72507742+EoinShaughnessy@users.noreply.github.com>
Co-authored-by: Chris Hill-Scott <me@quis.cc>
Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>
Co-authored-by: Chris Thomas <christopher.thomas@digital.cabinet-office.gov.uk>
Co-authored-by: Kimberly Grey <kimberly.grey@digital.cabinet-office.gov.uk>
Co-authored-by: Vanita Barrett-Smith <vanita.barrett@digital.cabinet-office.gov.uk>
Co-authored-by: terrysimpson99 <48089049+terrysimpson99@users.noreply.github.com>
Co-authored-by: Chris Ballantine-Thomas <chris.ballantinethomas@digital.cabinet-office.gov.uk>
Co-authored-by: Ciandelle Scollan <ciandelle.scollan@digital.cabinet-office.gov.uk>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ciandelle Scollan <100923629+Ciandelle@users.noreply.github.com>
Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>
Co-authored-by: domoscargin <brett.kyle@digital.cabinet-office.gov.uk>
Co-authored-by: ameliaphil <104211564+ameliaphil@users.noreply.github.com>
Co-authored-by: Colin Oakley <colin.oakley@engineering.digital.dwp.gov.uk>
Co-authored-by: Ruth Hammond <91464546+ruthhammond@users.noreply.github.com>
Co-authored-by: Colin <colin@htmlandbacon.com>
Co-authored-by: StephenGill <stephen.gill@digital.cabinet-office.gov.uk>
Co-authored-by: Laurence de Bruxelles <laurence.debruxelles@digital.cabinet-office.gov.uk>
Co-authored-by: CAAshworth <claire.ashworth@digital.cabinet-office.gov.uk>
Co-authored-by: owenatgov <owen.jones@digital.cabinet-office.gov.uk>
Co-authored-by: Robert Deniszczyc <72561986+robertdeniszczyc2@users.noreply.github.com>
Co-authored-by: NoraGDS <57447099+NoraGDS@users.noreply.github.com>
Co-authored-by: Andy Mantell <134642+andymantell@users.noreply.github.com>
Co-authored-by: Thomas Leese <thomas@leese.io>
Co-authored-by: Nick Colley <2445413+nickcolley@users.noreply.github.com>
Co-authored-by: Ed Horsford <mail@edwardhorsford.com>
Co-authored-by: Peter Yates <peter.yates@graphia.co.uk>

* Update/upstream (#60)

* Remove ƒ typo in fieldset example

* Fix autocomplete values in multiple address example

* Add latest blog posts April 2022

* Fix dashes and punctuation

* update image to make it neater on the check a service is suitable pattern page

* update image to make it neater on the check a service is suitable pattern page and compress it to save space

* Update Node to Active LTS version v16 (Gallium)

Node.js v14 has been in maintenance mode from 19 October 2021. v16 is the active LTS version.

This in turns updates NPM to v8, meaning our lockfile has change to [`lockfileVersion` 2](https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json#lockfileversion)

This is an internal change that affects development, testing and deployment.

* Add troubleshooting documentation for Node 16, node-sass and M1 machines

If a user has previously installed locally using Node 14 and lower on their M1 machine, they will encounter `node-sass` errors when running `npm install` after pulling this commit.

This adds documentation to deal with those errors.

This should only affect developers.

* Update metalsmith to latest version (2.4.2)

* Install @metalsmith/sass

* Uninstall metalsmith-sass and node-sass

We've installed @metalsmith/sass which uses sass (Dart Sass)
under the hood instead.

* Set `quietDeps` to true and move config to @metalsmith/sass syntax

Move the existing sass config to @metalsmith/sass syntax (uses loadPaths
instead of includePaths)

Set the `quietDeps` flag to true to suppress sass  deprecation warnings for
division (/) and any future deprecations coming from GOV.UK Frontend.

* Add 'src/stylesheets' to sass loadPaths

Dart Sass wasn't able to resolve the import for 'example-init', which
we use within our component example sass.

Telling it to look in 'src/stylesheets' to resolve imports, so it can find
this file.

* Remove node-sass on node v16 troubleshooting docs

We've updated Metalsmith and moved to Dart Sass, so this issue no longer applies (see https://github.com/alphagov/govuk-design-system/pull/2150)

* Update link text in examples

This aims to make the difference between the `class` and the link text clearer, particularly for people relatively new to HTML.

* Add new team member

* Make help text advice clearer in fieldset guidance

* Add placeholder text info to text input guidance

* Revert town or city field to use address-level2

* Explain issues with client side validation

* Add implementation advice to skip link guidance

* Add subheadings to text input guidance

* Replace double quotes with singles in example

* Updating error example for National Insurance number to use correct format

* adding format guidance for National Insurance number

* Update design-system-team.md.njk

Added myself to the team member list

* Update src/design-system-team.md.njk

Co-authored-by: Kimberly Grey <kimberly.grey@digital.cabinet-office.gov.uk>

* Update src/patterns/national-insurance-numbers/index.md.njk

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Move #top anchor to before the skip link

The ‘back to top’ link takes users to the #top anchor point, which is currently before the navigation but after the ‘skip to main content’ link.

This means you can no longer skip past the navs etc (as per WCAG 2.1 2.4.1 Bypass Blocks [1]) unless you know to press shift + tab to go backwards in the tab order.

Insetead, we want the 'back to top' link to take the user to the very top of the page, so that the next tab will take them to ‘Skip to main content’ (or the cookie banner, if it’s not been dismissed).

We also considered taking the user to the start of `#main` [2], bypassing all of the navigation, but opted instead to move the `#top` anchor to be the very first thing because:

1. The back to top link was introduced in #687, when we moved from the side navigation and the main content being fixed, independently scrollable panes. This change meant that the side navigation no longer remained within the viewport.

It seems that the intent at the time was that the back to top link would bring the side navigation back into view, rather than providing a convenient way for the user to get back to the top of the main content.

2. Linking to #main makes it harder for users who have to get back to the navigation:

> If you're using a screen reader you could jump between landmarks using hot keys, but if you're just using a keyboard you're kinda just left with the tab key. Maybe I'm missing something, but the only options I could see to get back to the nav would be:
>
> - use TAB to go all the way through the content and footer content until you eventually get back to the top of the page
> - use back to top to get to the top of the main, and then use SHIFT+TAB to reverse through the nav menu
> - refresh the page and use TAB

3. We think users would expect to see the header when using the ‘Back to top’ link, especially if they were aiming for the navigation.

[1]: https://www.w3.org/TR/WCAG21/#bypass-blocks
[2]: https://github.com/alphagov/govuk-design-system/issues/1561#issuecomment-964273009

Closes #1561

* Make layout name consistent throughout guidance

* Update guidance on footer component

This proposed update:

- adds links to relevant information on privacy notices, cookie pages and accessibility statements
- clarifies copyright and licensing information

Related issues:

https://github.com/alphagov/govuk-design-system/issues/1225
https://github.com/alphagov/govuk-design-system/issues/1306

* Update character count guidance to match new implementation

* Minor edits for consistency

* Clarify and add accessibility information

* Update What's New section for v4.1.0

* Update roadmap

* Add context to JAWS issue

* Bump govuk-frontend to 4.1.0

* Add nodeListForEach helper directly into design system

The GOV.UK Frontend ES modules don't make the common (e.g: `nodeListForEach`)
function available to import. We've made this decision intentionally as we never
really intended for `nodeListForEach` to be something we provided.

This introduces a helper.js file which contains `nodeListForEach`. Switch our
JS files to use that helper, rather than the one from GOV.UK Frontend.

* Replace individual JS imports with ES modules initAll

* Explain that red border depends on exceeding limit

* Add accurate content for email field char limit

* Replace in guidance and examples

-  error message
 - textarea
 - text input
 - character count (including error example)

* Bump actions/setup-node from v2 to v3

* Use node-version-file input to specify node version

actions/setup-node v2.5.0 and above support reading a .nvmrc file itself [[1]].
This lets us simplify our code.

[1]: https://github.com/actions/setup-node/releases/tag/v2.5.0

* Make validation guidance language more consistent

* Add info on default components in page template

* Change contact panel headings to reflect the kind of page they're on

* Make link text in example reflect guidance

* Reorder link text

* Update team page on Design System site

* Update cookie hide button to be more descriptive

Change cookie button text from 'Hide this message' to
'Hide cookie message' to provide context to any users using
assistive tech navigating out of context.

* Add Claire to team page

* Fix em-dash

* Remove last line about performance platform

Remove last line on the Payment Card details page, which refers to the performance platform. This platform no longer exists.

* add a hint to the select to help users understand the options

* Bump govuk-frontend to v4.2.0

* Add guidance for pagination component

Iterate content and add headings for examples

Fix typo for heading level

Fix headings

Add guidance for pagination component

Iterate content and add headings for examples

Fix typo for heading level

Fix headings

Apply suggestions from tech writer review

Co-authored-by: EoinShaughnessy <72507742+EoinShaughnessy@users.noreply.github.com>

Update pagination guidance

Updated guidance to:

- cover issues raised by working group
- clarify use case for different types of pagination - and when to use 'continue' button and back link instead

Minor edits for dashes and contractions

Tweaking paragraph breaks

Remove section about saying "page" in labels

By default, "Previous" and "next" do not include "page" so this section is no longer needed

* Remove pagination component from community backlog

* Update what's new and roadmap for 4.2.0

* Update roadmap

Tidying up and reorganising some of our roadmap items in mid-2022.

* Fixed typo on pagination documentation

* Add paragraph tag to link example

This link example does not include a wrapping element, meaning that some of the text is appearing as default serif text instead of in Transport. As the text above this example states that it is
regarding links at the end of sentences or paragraphs, the example shouldn't be negatively affected by the inclusion of a paragraph.

* Indent Nunjucks code

Attempt to make this file easier to read by indenting Nunjucks code similarly to HTML.

* Refactor design system tabs JS

* Fix tab not being opened when macro options are linked to

* Update test ID and result checks

* Check for existence of tabs

* Update team member

Add Ben to the team

* Remove govuk-react-jsx which is no longer supported

* Bump terser from 5.7.0 to 5.14.2

Bumps [terser](https://github.com/terser/terser) from 5.7.0 to 5.14.2.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

---
updated-dependencies:
- dependency-name: terser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump moment from 2.29.2 to 2.29.4

Bumps [moment](https://github.com/moment/moment) from 2.29.2 to 2.29.4.
- [Release notes](https://github.com/moment/moment/releases)
- [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/moment/moment/compare/2.29.2...2.29.4)

---
updated-dependencies:
- dependency-name: moment
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply `this` binding changes from code review

Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>

* Refactor getDesktopTab to not use a loop

* Bump metalsmith to 2.5.0

* Remove ‘mainstream’ from images guidance

Instead, define non-service content by content type and publishing method.

As flagged in https://github.com/alphagov/govuk-design-system-backlog/issues/70#issuecomment-1187335536:

> Mainstream is 2500 pages managed by GDS, but this guidance also applies to all content on www.gov.uk produced by depts, the half a million 'whitehall' pages.

Co-authored-by: Calvin Lau <77630796+calvin-lau-sig7@users.noreply.github.com>

* Use the official core metalsmith postcss plugin

Metalsmith is being updated fairly regularly now, and have an [official PostCSS plugin](https://github.com/metalsmith/postcss).

We've been blocked on bumping some dependencies because of this (#2016).

I've run `npm build` and there is one small prefixing change in the resulting CSS, but otherwise it's exactly the same.

* Only toggle details aria attributes if already set

I believe this dates from when the polyfill for the `<details>` element used to be applied in all browsers, and added extra ARIA attributes which always needed to be kept in sync when this script toggled the open state.

However, since GOV.UK Frontend v3.1.0 the polyfill now does nothing in browsers that natively support the <details> elements [1].

This means that once these attributes are set on page load, unless the polyfill is running there is nothing to keep them in sync if the user toggles the details element:

- `aria-expanded` will always be `true`, potentially causing AT to announce the expanded state incorrectly
- `aria-hidden` will always be `false` – although this is likely not an issue as aria-hidden can't make things hidden using display:none 're-appear' in the accessibility tree

Instead, only toggle `aria-expanded` if it is already set on the element (which should only happen if the polyfill has run, in which case the browser does not natively support the `<details>` element).

We also need to re-introduce the `aria-hidden` attribute removed in 8b53583 as when the polyfill runs it currently adds an `aria-hidden` attribute which means the content inside the `<details>` element will be inaccessible even when opened unless we remove it.

Add a comment to try and explain why this code needs to exist.

[1]: https://github.com/alphagov/govuk-frontend/pull/1523

* Bump metalsmith-env to 2.2.0

- Allow storing the environment variables under a metadata[metadatakey] instead of metadata. See opts.metadatakey for more details.
- Dependency updates

* Use @metalsmith/in-place in favour of metalsmith-in-place

Core metalsmith plugin is effectively an updated version of the previous package.

v4.5.0

- feat: org migration, core plugin alignment
- feat: use metalsmith.match instead of multimatch, drop Node < 10 support
- feat: better jsdoc typehints & defaults mgmt
- fix: don't mistake dots in folder paths for extensions

* Use @metalsmith/layouts in favour of metalsmith-layouts

The core plugin replaces the old one.

v2.5.1
- pass the transformed list of files to metalsmith.match…
- Merge pull request #184 from doteco/master
- pass the transformed list of files to metalsmith.match so that renamed files can be matched

v2.5.0

- use metalsmith.match instead of multimatch
- Remove semicolons, run formatting. Remove devDependencies
- feat: add JSdocs, named plugin function
- Dependencies: updates debug to 4.3.4
- Drop Node < 12 support

2.4.0

- Return when done
- Improve readme
- Align dotfiles, repo with core plugin setup @metalsmith
- deps: update dependencies and fix prefer-object-spread

* Use @metalsmith/permalinks in favour of metalsmith-permalinks

Core plugin replaces old package.

Changelog: https://github.com/metalsmith/permalinks/blob/master/CHANGELOG.md

* Bump metalsmith-uglify to v2.4.1

Patch bump to update some dependencies.

* Bump @metalsmith/sass from 1.0.0 to 1.0.1

Changes: https://github.com/metalsmith/sass/compare/1.0.0...1.0.1

* Adjust link text to GOV.UK image guidance

* Allow start buttons to be forms

Although unusual, there are a few valid circumstances where you might
want to submit a form when pressing the start button. A situation that
came up recently was we wanted to record analytics on when a user
started a service by recording the time that a user presses the start
button, without client-side JavaScript. The implementation for this
involved using the Rails `button_to` helper which generates a form which
POSTs to a route and includes a single `submit` button.

I think this is a valid use case of the start button, so I suggest
changing the wording on this to be slightly more open to the idea of
the start button not being a link.

* Update link to task list Sass file

This file has changed location in recent changes to the Prototype Kit, this updates the URL to no longer 404.

* Override auto-linking with period character

* Move width override classes from spacing to layout

Overriding the width of an element really has nothing to do with spacing, so this guidance make more sense as part of the layout guidance, alongside the documentation about the grid system which uses the same ‘one third’, ‘one half’ concepts.

* Tweak width override guidance for new context

Remove the link to the grid system which is now on the same page and is introduced before the override classes

Remove a reference to the spacing override classes which doesn’t make sense now that they’re on a separate page and the user might not have read about them already.

* Update links to width override classes

* Remove link to archived ethnic groups pattern

The ethnic groups pattern was archived in #1582.

* Remove broken link in page template guidance

The ‘variables’ and ‘blocks’ tables were merged in #1311 but this link was missed.

* Remove redundant classes

As noted in https://github.com/alphagov/govuk-frontend/issues/2733, these classes don’t actually do anything.

* Remove extra closing `</tr>` tag

* Swap small and large screen sizes in spacing table

Putting the smaller sizes on the left-hand size seems more logical and fits better with a mobile-first approach.

* Flip order of spacing scale in table

Going from the smallest size to the largest size just makes more sense.

* Fix mismatched heading tags in navigation

* Document the static spacing scale

Fixes #1210.

* Improve headings for override classes and helpers

* Move section on overrides last

Try to encourage users who are writing their own CSS to use the helpers that we provide rather than the override classes, by making it more likely they’ll read about them first.

* Update link to my talk for more accessible blog

Allows more options to access it as I've made it into a blog post too.

* Tweaks to guidance on helpers

* Tweaks to guidance on override classes

* Bump autoprefixer to 10.4.7

One major version bump. Version 10:

- Uses PostCSS 8
- Removes support for Node.js 6, 8 and 11
- …
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

details component not announcing collapsed/expanded state on iOS with VoiceOver
3 participants