govuk-frontend
Advanced tools
Changelog
5.3.1 (Fix release)
To install this version with npm, run npm install govuk-frontend@5.3.1
. You can also find more information about how to stay up to date in our documentation.
We've made fixes to GOV.UK Frontend in the following pull requests:
attributes
option ignoring values passed from the safe
filter Changelog
5.3.0 (Feature release)
To install this version with npm, run npm install govuk-frontend@5.3.0
. You can also find more information about how to stay up to date in our documentation.
The Password input component allows users to choose:
This helps users use longer and more complex passwords without needing to remember what they've already typed.
This change was introduced in pull request #4442: Create password input component. Thanks to @andysellick for the original contribution.
We've updated the HTML for the Character count component. The component wrapper data-module="govuk-character-count"
and its form group class="govuk-form-group"
are now combined as the same <div>
. The hint text used as the count message now appears directly after the <textarea>
.
If you're not using Nunjucks macros, then you should:
<div>
to the component wrapper <div>
<div>
and closing </div>
tags used by the form group<textarea>
The following example shows some HTML and the difference once it’s updated.
HTML before:
<div class="govuk-character-count" data-module="govuk-character-count" data-maxlength="100">
<div class="govuk-form-group">
<!-- // Label, hint, error and textarea -->
</div>
<!-- // Count message -->
</div>
HTML after:
<div class="govuk-form-group govuk-character-count" data-module="govuk-character-count" data-maxlength="100">
<!-- // Label, hint, error, textarea and count message -->
</div>
Check your changes against the Character count example in the Design System to make sure you’ve correctly implemented them.
This change was introduced in pull request #4566: Use Character count formGroup
as module wrapper.
role
attributes from elementsWe've made minor changes to the HTML of the page template, as well as the header, footer and pagination components.
You can update your HTML to remove the role
attribute from some elements. These include the:
main
role on the main
element in the templatebanner
role on the header
element in the Header componentcontentinfo
role on the footer
element in the Footer componentnavigation
role on the nav
element in the Pagination componentThese roles were present to support legacy browsers, such as older versions of Internet Explorer. GOV.UK Frontend no longer supports these browsers, so you can now remove these roles.
You do not need to change anything if you're using the Nunjucks versions of the page template or these components,
This change was introduced in pull request #4854: Remove redundant role
attributes.
We've fixed an upstream issue in the cssnano npm package that caused elements with transparency to render incorrectly in Internet Explorer 11. This affected the pre-compiled CSS files in the GOV.UK Frontend npm package and GitHub releases for versions 5.0, 5.1 and 5.2. This was fixed in:
We've made fixes to GOV.UK Frontend in the following pull requests:
KeyboardEvent.key
over deprecated KeyboardEvent.keyCode
in the Tabs componentKeyboardEvent.key
over deprecated KeyboardEvent.keyCode
in the Button componentKeyboardEvent
properties from the Exit this Page componentChangelog
5.2.0 (Feature release)
In this release, we’ve adjusted our responsive type scale, which is available behind a feature flag. The type scale change is to make text easier to read on smaller screens. We’ve also deprecated the useTudorCrown
parameter.
To install this version with npm, run npm install govuk-frontend@5.2.0
. You can also find more information about how to stay up to date in our documentation.
We've made the following adjustments to our responsive type scale:
To enable these changes, set the feature flag variable $govuk-new-typography-scale
to true
before you import GOV.UK Frontend in your Sass files:
// application.scss
$govuk-new-typography-scale: true;
@import "govuk-frontend/all";
If your service uses custom elements made using GOV.UK Frontend, test your service against the new typography scale to assess if you need to make any adjustments.
You can read more on upgrading your service to the new type scale in our upgrade guide.
This change was introduced in pull request #2421: Adjust the responsive type scale
You can now insert custom HTML into form group wrappers for all components with form fields.
govukInput({
formGroup: {
beforeInput: {
html: "example"
},
afterInput: {
html: "example"
},
}
})
This change was introduced in pull request #4567: Add beforeInput(s)
and beforeInput(s)
options to form groups.
useTudorCrown
parameter in the Heading componentThe rollout for the revised GOV.UK logo has started and the Tudor crown logo is now shown by default. We’ve deprecated the useTudorCrown
parameter and will remove it in the next major release.
You can now remove the useTudorCrown
parameter, along with any other adjustments made to display the Tudor crown logo in your service.
This change was introduced in pull request #4740: Make Tudor Crown logo the default
We've made fixes to GOV.UK Frontend in the following pull requests:
Changelog
5.1.0 (Feature release)
To install this version with npm, run npm install govuk-frontend@5.1.0
. You can also find more information about how to stay up to date in our documentation.
Changelog
5.0.0 (Breaking release)
You can find a summary of the main changes to GOV.UK Frontend v5 on the Frontend site. It's important to note our old frameworks (such as GOV.UK Elements) are no longer compatible with this release. It also stops Internet Explorer 11 from running GOV.UK Frontend JavaScript and removes support completely for Internet Explorer 8 to 10.
Your service will not stop working in Internet Explorer 11, but components will look and behave differently without JavaScript. Read more about how we provide support for different browsers.
Service teams should be using a progressive enhancement approach to make sure users can still access any content and complete their tasks.
If you still need to provide support for older versions of Internet Explorer, you should stay on the latest GOV.UK Frontend v4 release.
If you need it, we have a checklist for the changes you might need to make for v5, which you can view or copy (needs a Google account).
You must make the following changes when you migrate to this release, or your service might break.
In preparation for additional build targets, we've moved our package files into a directory called dist
.
Replace govuk-frontend/govuk
with govuk-frontend/dist/govuk
in any Sass @import
paths.
For example:
@import "node_modules/govuk-frontend/dist/govuk/all";
If you've added node_modules/govuk-frontend
as a Sass import path, update it with the /dist
suffix:
loadPaths: [
'node_modules/govuk-frontend/dist'
]
If you're building your Sass code through Rails Assets Pipeline or Sprockets, refer to the section 'Update package file paths in Rails Assets Pipeline or Sprockets'.
Refer to the detailed guidance on importing using Sass.
These changes were introduced in #3498: Remove built dist
and package
from source
In preparation for additional build targets, we've moved our package files into a directory called dist
.
Replace govuk-frontend
with govuk-frontend/dist
in any nunjucks.configure()
search paths:
nunjucks.configure([
'node_modules/govuk-frontend/dist'
])
Refer to the detailed guidance on using Nunjucks.
These changes were made in the following pull requests:
govuk-frontend
via local packagedist
and package
from sourceIn preparation for additional build targets, we've moved our package files into a directory called dist
.
If you're serving the assets from the GOV.UK Frontend assets folder (node_modules/govuk-frontend/govuk/assets
), update your routing to the new assets path : node_modules/govuk-frontend/dist/govuk/assets
.
Refer to the detailed guidance on importing assets.
These changes were introduced in #3498: Remove built dist
and package
from source
In preparation for additional build targets, we've moved our package files into a directory called dist
.
Update the node_modules/govuk-frontend
part of the path to node_modules/govuk-frontend/dist
, if you've added the path to GOV.UK Frontend package inside node_modules
to:
Rails.application.config.assets.paths
append_path
These changes were introduced in #3498: Remove built dist
and package
from source
In preparation for additional build targets, we've moved our package files into a directory called dist
.
If you've set up your routing to serve GOV.UK Frontend's all.js
file from node_modules
, update the path you're serving to node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js
.
Update any <script>
tag with the new path and filename, if necessary. Make sure they have a type="module"
attribute. For example:
<script type="module" src="{path-to-javascript}/govuk-frontend.min.js"></script>
Replace <script>window.GOVUKFrontend.initAll()</script>
to import and initialise GOV.UK Frontend using ES modules:
<script type="module">
import { initAll } from '{path-to-javascript}/govuk-frontend.min.js'
initAll()
</script>
Refer to the detailed guidance on importing JavaScript.
These changes were introduced in #3498: Remove built dist
and package
from source