GOV.UK Frontend v5.3.0
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.
New features
Use the Password input component to help users accessibly enter passwords
The Password input component allows users to choose:
- whether their passwords are visible or not
- to enter their passwords in plain text
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.
Recommended changes
Update the HTML for the Character count component
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:
- move all classes and attributes from the form group
<div>
to the component wrapper<div>
- remove the opening
<div>
and closing</div>
tags used by the form group - check the count message is now directly after the
<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.
Remove redundant role
attributes from elements
We'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 themain
element in the templatebanner
role on theheader
element in the Header componentcontentinfo
role on thefooter
element in the Footer componentnavigation
role on thenav
element in the Pagination component
These 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.
Fixes
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:
- #1573: feat: add preset and plugin options for browserslist in the cssnano repository
- #4829: Bump the postcss group with 2 updates
We've made fixes to GOV.UK Frontend in the following pull requests:
- #4811: Use
KeyboardEvent.key
over deprecatedKeyboardEvent.keyCode
in the Tabs component - #4812: Use
KeyboardEvent.key
over deprecatedKeyboardEvent.keyCode
in the Button component - #4813: Remove deprecated
KeyboardEvent
properties from the Exit this Page component - #4855: Fix mobile product name being misaligned in new type scale