Skip to content

Commit

Permalink
Add changelog entry for component's configuration
Browse files Browse the repository at this point in the history
Entry covers multiple PRs and was missed when implementing the feature

Closes  #2885
  • Loading branch information
romaricpascal committed Oct 18, 2022
1 parent 023c3bf commit 0ef6094
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,42 @@ $govuk-suppressed-warnings: (

This was added in [#2911 Add warning suppression functionality](https://github.com/alphagov/govuk-frontend/pull/2911)

#### Configure components in JavaScript

JavaScript components receiving configuration through data attributes now accept the same configuration options when instantiated in JavaScript. These components are:

- the `Button` component, for its `preventDoubleClick` option (matching `data-prevent-double-click`)
- the `CharacterCount` component, for its `maxlength`,`maxwords` and `threshold` options (matching `data-maxlength`, `data-maxwords` and `data-threshold`, respectively)
- the `ErrorSummary` component, for its `disableAutoFocus` option (matching `data-disable-auto-focus`)
- the `NotificationBanner` component, for its `disableAutoFocus` option (matching `data-disable-auto-focus`)

You can omit these options when calling the Nunjucks macro and provide them:

- at component instantiation, in a configuration object as second argument, for example:

```js
var errorSummary = document.querySelector('[data-module="error-summary"]')
new GOVUKFrontend.ErrorSummary(errorSummary, {disableAutoFocus: true})
```

- when initialising components in bulk using `initAll`, for example:

```js
GOVUKFrontend.initAll({
errorSummary: {
disableAutoFocus: true
}
// Or, for the other components,
// button: {/* options */},
// characterCount: {/* options */},
// notificationBanner: {/* options */}
})
```

If you provide an option both through data attribute and JavaScript configuration, the components will use the value from the data attribute.

This was added in pull requests specific for each components: [NotificationBanner – #2843](https://github.com/alphagov/govuk-frontend/pull/2843), [ErrorSumarry – #2854](https://github.com/alphagov/govuk-frontend/pull/2854), [Button – #2883](https://github.com/alphagov/govuk-frontend/pull/2883), and [CharacterCount – #2887](https://github.com/alphagov/govuk-frontend/pull/2887)

### Recommended changes

#### Remove `aria-labelledby`, remove `id="error-summary-title"` from title and move `role="alert"` to child container on the error summary component
Expand Down

0 comments on commit 0ef6094

Please sign in to comment.