Remove error summary override init
function
#2039
Merged
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.
Fixes #1666
Note: this PR uses a pre-release of GOV.UK Frontend. The first commit will need to be deleted before merging.
What
Replaces the JavaScript override of the error summary
init
function with the newdisableAutoFocus
macro option instead.Doing this means we have to introduce
code.njk
files for our error summary component examples, so that users viewing the HTML and Nunjucks code examples don't see thedisableAutoFocus
macro option/data attribute being set and accidentally copy that into their own service.There should be no visual/behavioural changes as a result of this PR.
disableAutoFocus
macro option or thedata-disable-auto-focus
attributeWhy
When we release v4.0.1 of GOV.UK Frontend, it'll include a change to allow
disableAutoFocus
to be passed to the error summary component. We don't want auto focus on the design system website - if we did have it enabled then if someone visited https://design-system.service.gov.uk/components/error-summary/ they would be autofocused on the examples.At the moment we have a line of JavaScript code that overrides the error summary
init
function to disable the auto focus behaviour. With v4.0.1, we can replace this and use thedisableAutoFocus
macro option instead.