[Snyk] Upgrade govuk-frontend from 3.0.0 to 3.5.0 #400
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Snyk has created this PR to upgrade govuk-frontend from 3.0.0 to 3.5.0.
ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.Release notes
Package name: govuk-frontend
New features
Add classes to the character count component's count message
If you're using Nunjucks, you can now add classes to the character count component's count message using the
countMessage.classes
option.Fixes
input type=text inputmode=numeric
.govuk-media-query
mixin.New features
Add classes to the page wrapper
If you're using Nunjucks, you can now add classes to the page wrapper using the
containerClasses
variable.Pull request #1626: Allow creating custom width containers and using them with template.
Set a custom width for wrappers
If you're using Sass, you can now use the
govuk-width-container
mixin to create a custom wrapper class with a specific width. You can then add that class to the following wrappers to override the width of thegovuk-width-container
class:To create your custom wrapper class, include the
govuk-width-container
mixin. Pass in the width in pixels.For example:
If you’re using Nunjucks, you should then add your class using either the:
containerClasses
variable in the page templatecontainerClasses
option in the header or footerUse the
$govuk-page-width
Sass variable instead if all your pages are the same width.Add attributes to the
<body>
element of a pageYou can now add attributes to the
<body>
element of a page, by using thebodyAttributes
variable in the page template.Fixes
This release contains some smaller features and bug fixes that include accessibility improvements.
New features
Allow
lang
to be set on<title>
and<main>
of templateYou can now set the lang attribute in the title and main of page template.
This will help with scenarios where some of the elements, such as navigation and footer, are in English whereas the title and page content are in a different language.
lang
to be set on title and main of template.Add new override class to hide elements
You can now use the
.govuk-!-display-none
override class to hide elements.Visual updates to the warning text component
Align ‘Warning text’ icon with first line of the content fixing #1352 Some changes were made to the size and spacing of the icon to help with positioning.
Fixes
Closes #1600
This release is another smaller release with some new features and fixes 🐛 🔨
If you're using GOV.UK Frontend with GOV.UK Template, the button component is now readable when it has an active focus state.
Thanks to Emma Lewis for helping with this release.
New features
Add classes to the form group wrapper of the character count component
You can now add classes to the form group wrapper of the character count component.
Fixes
This release contains a few improvements and fixes that include accessibility improvements to the details component.
Thanks to @htmlandbacon and @andrew-mcgregor for their help with this release.
Changelog
New features
Add attributes to the fieldset on the date input component
You can now pass attributes to add to the fieldset on the date input component.
Pull request #1541: Allow date input fieldset attributes to be set. Thanks to andrew-mcgregor for raising this.
Add ARIA role to the fieldset component
You can now pass an ARIA role to the fieldset component.
Pull request #1541: Allow date input fieldset attributes to be set.
Add inputmode to the input component
You can now pass inputmode to the input component.
Fixes
In this release, we’ve made some important changes to improve the accessibility of pages built with GOV.UK Frontend. This includes making sure that the styles, components and patterns in GOV.UK Frontend meet level AA of WCAG 2.1.
We recommend you update GOV.UK Frontend with npm.
If you’re updating compiled files, you only need to:
Contact the GOV.UK Design System team if you need help updating or installing GOV.UK Frontend.
Thanks to @colinrotherham, edwardhorsford, @frankieroberto and @Nooshu for their help with this release.
Breaking changes
You must make the following changes when you migrate to this release, or your service may break.
Update file paths, attributes and class names
To make sure GOV.UK Frontend's files do not conflict with your code, we've moved our package files into a directory called
govuk
.If you’re using Sass
Add
govuk/
aftergovuk-frontend/
to@import
paths in your Sass file.For example:
If you’ve added
node_modules/govuk-frontend
as a Sass include path, addgovuk/
to your@import
paths:If you’re using Javascript
You must do the following.
data-module
attributes.Update file paths
You must add
govuk/
to your import paths.If you're importing
node_modules/govuk-frontend/all.js
, change this import path tonode_modules/govuk-frontend/govuk/all.js
.If you’re importing a specific path, add
govuk/
aftergovuk-frontend/
. For example, if you're importing the button component:Update and add data-module attributes
You do not need to do anything if you're using Nunjucks macros and the
initAll
function.If you are not using Nunjucks macros, add a
govuk-
prefix todata-module
attribute values. For example:The button and details components now also use the
data-module
attribute for initialisation. If you are not using Nunjucks macros, add:data-module="govuk-button"
to each<button>
HTML tagdata-module="govuk-details"
to each<details>
HTML tagIf you're using your own JavaScript code to initialise components, add a
govuk-
prefix to any selectors that find components using thedata-module
attribute.Pull request #1443: Ensure GOV.UK Frontend component selectors cannot conflict when initialised
Update CSS class names
You do not need to do anything if you're using Nunjucks.
If you're using HTML or custom JavaScript, change:
js-character-count
togovuk-js-character-count
js-header-toggle
in the GOV.UK Frontend header component togovuk-js-header-toggle
Pull request #1444: Renames
js-
css prefix togovuk-js-
If you’re using Nunjucks
nunjucks.configure
so that the only GOV.UK Frontend path isnode_modules/govuk-frontend/
:govuk/
to the template path:govuk/components/
. For example:Update asset paths
In the assets path, add
govuk/
aftergovuk-frontend/
:/node_modules/govuk-frontend/govuk/assets
If your code uses Express.js, you must also use the following code in your configuration file:
Pull requests:
Migrate to the new accessible focus states
The focus state of components now meets the new WCAG 2.1 level AA requirements.
You must update your component’s focus state to make your design consistent with our new focus styles.
If you've extended or created components, you can no longer use the
govuk-focusable
orgovuk-focusable-fill
Sass mixins.If you're using
govuk-focusable
, you must remove it. There’s no direct replacement, so you must use our Sass variables to make your components consistent with GOV.UK Frontend.If you're using
govuk-focusable-fill
, include thegovuk-focused-text
mixin inside your component's:focus
selector. For example:Pull requests:
govuk-focusable
,govuk-focusable-fill
mixins, introducegovuk-focus-text
mixinUpdate colours
You can now use the following new colour variables that we've added to the colour palette:
5 Sass colour variables no longer exist. Replace the following colour variables if you're using Sass:
You should check the contrast ratio of your colours.
If you're not using Sass, change the values of the following colours:
We've also changed the background of the following components:
green
instead of a custom greengreen
instead ofturquoise
dark-blue
instead oflight-blue
If you're using legacy projects like GOV.UK Elements, you can keep your current colours by turning on compatibility mode.
Read our blog post about why we changed the colour palette.
Pull request #1288: Update colour palette.
Check the new version of the font
The size and baseline of the Design System's font are now more consistent with other fonts. Text now aligns vertically in text boxes without you needing to adjust it.
If you've extended or created components, you should check that your text is still vertically aligned correctly.
If you're using GOV.UK Frontend and GOV.UK Template, you can turn on compatibility mode to keep using the font from GOV.UK Template.
Pull requests:
Update links from error summary components to radios and checkboxes
If you've linked from an error summary component to the first input in a radios or checkboxes component, the link will no longer work.
This is because the
id
of the first input no longer has the suffix-1
.If there are links back to radios or checkboxes components in your error summary component, remove
-1
from the end of thehref
attribute.Pull request #1426: Make radios and checkboxes components easier to link to from error summary
Update the markup for tabs
You do not need to do anything if you're using Nunjucks macros.
If you are not using Nunjucks macros, remove the
govuk-tabs__tab--selected
class from the first tab's link, then add thegovuk-tabs__list-item--selected
class to that link's parent list item.For example:
Pull request #1496: Update the focus state for tabs
Update start button icon
Start buttons have a new icon. Your start buttons will lose their current icons unless you replace the old icon with the new one.
If you're using Nunjucks:
isStartButton
option totrue
.govuk-button--start
classFor example:
If you're using HTML, add the SVG code from the start button example in the Design System.
Pull request #1341: Add new start button icon
Adjust text alignment in tables
Text now aligns to the top of table cells. If you've used a different alignment in a table, you should use your own CSS styles to keep the alignment the same.
For example, to align text in the centre:
Pull request #1345: Set 'vertical-align:top' positioning on table headers and cells
Replace Sass mixins in grids
If you're using the
@govuk-grid-column
Sass mixin to create custom grid classes, you must remove the$class
parameter.If you're passing a class name, put the mixin inside your selector. For example:
You can no longer use the
govuk-grid-row
mixin. You can replace it with the.govuk-grid-row
class in your HTML.You must also replace calls to the
grid-width
mixin with calls to thegovuk-grid-width
mixin.Pull requests:
Rename the border width variable
If you use Sass and you’ve extended or created components that use the border width variable, rename
$govuk-border-width-mobile
to$govuk-border-width-narrow
.Pull request #1287: Rename border-width-mobile to reflect how it's used
New features
Add attributes to table headings
You can now add attributes like classes, rowspan and colspan to table row headers.
Pull request #1367: Allow for classes, rowspan, colspan and attributes on row headers. Thanks to edwardhorsford.
Use page wrapper auto spacing
You can now add the
.govuk-main-wrapper--auto-spacing
modifier class to your<main>
element to add responsive padding to the top and bottom of the page.This will add the correct amount of padding depending on if there are elements above the
<main>
element inside thegovuk-width-container
wrapper. Elements above the<main>
element could include a back link or breadcrumb component.If you need to control the spacing manually, use the
.govuk-main-wrapper--l
modifier instead.The
govuk-main-wrapper
andgovuk-main-wrapper--l
Sass mixins are now deprecated. Contact us if you need to continue using these mixins.Pull request #1493: Add automatic vertical spacing modifier for main wrapper
GDS Transport now falls back to Arial in Internet Explorer 8 (IE8)
IE8 will now use Arial instead of GDS Transport.
This is because IE8 requires a very large Embedded Open Type (.eot) font file for external fonts. Arial will take less time to render for IE8 users, who are likely to be on older computers.
Pull request #1434: Update font to use v2 of GOV.UK Transport font. Thanks to @Nooshu.
Fixes
GOV.UK Template's focused link colour no longer overrides GOV.UK Frontend.
productName
andserviceName
in the header component - thanks to @edwardhorsford.Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.
For more information:
🧐 View latest project report
🛠 Adjust upgrade PR settings
🔕 Ignore this dependency or unsubscribe from future upgrade PRs