govuk_publishing_components 44.1.0 → 44.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +336 -225
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +334 -226
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.mjs +3 -0
- data/node_modules/govuk-frontend/dist/govuk/all.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest.svg +1 -0
- data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
- data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +21 -1
- data/node_modules/govuk-frontend/dist/govuk/common/index.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/_index.scss +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +92 -26
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +92 -26
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +12 -21
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +86 -20
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +86 -20
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs +6 -16
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +89 -23
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +89 -23
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +10 -19
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +113 -47
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +113 -47
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs +7 -16
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss +7 -2
- data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +86 -20
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +86 -20
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +6 -16
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +87 -21
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +87 -21
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs +7 -16
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +8 -10
- data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +8 -0
- data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/header/fixtures.json +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +87 -21
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +87 -21
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +7 -16
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-full-width-border.html +24 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +86 -20
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +86 -20
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs +6 -16
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +89 -23
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +89 -23
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs +9 -18
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +113 -47
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +113 -47
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs +7 -16
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +168 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss +4 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/fixtures.json +464 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro-options.json +138 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +249 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +241 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs +85 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-default.html +57 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-html-navigation-items.html +49 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-large-navigation.html +153 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-long-service-name.html +20 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-navigation-with-a-current-item.html +58 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-navigation-with-an-active-item.html +58 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-non-link-navigation-items.html +49 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-link.html +20 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-name-and-navigation.html +63 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-name.html +18 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template.njk +102 -0
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +93 -26
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +93 -26
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +13 -21
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +93 -27
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +93 -27
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +13 -22
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +4 -3
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs +16 -3
- data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend-component.mjs +49 -5
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend-component.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +2 -2
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/init.mjs +72 -10
- data/node_modules/govuk-frontend/dist/govuk/init.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +3 -0
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss.map +1 -1
- data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +5 -1
- data/node_modules/govuk-frontend/package.json +8 -8
- metadata +29 -4
- data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest-2x.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest.png +0 -0
@@ -68,6 +68,19 @@ function extractConfigByNamespace(Component, dataset, namespace) {
|
|
68
68
|
}
|
69
69
|
return newObject[namespace];
|
70
70
|
}
|
71
|
+
function isInitialised($root, moduleName) {
|
72
|
+
return $root instanceof HTMLElement && $root.hasAttribute(`data-${moduleName}-init`);
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Checks if GOV.UK Frontend is supported on this page
|
77
|
+
*
|
78
|
+
* Some browsers will load and run our JavaScript but GOV.UK Frontend
|
79
|
+
* won't be supported.
|
80
|
+
*
|
81
|
+
* @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support
|
82
|
+
* @returns {boolean} Whether GOV.UK Frontend is supported on this page
|
83
|
+
*/
|
71
84
|
function isSupported($scope = document.body) {
|
72
85
|
if (!$scope) {
|
73
86
|
return false;
|
@@ -80,6 +93,9 @@ function isArray(option) {
|
|
80
93
|
function isObject(option) {
|
81
94
|
return !!option && typeof option === 'object' && !isArray(option);
|
82
95
|
}
|
96
|
+
function formatErrorMessage(Component, message) {
|
97
|
+
return `${Component.moduleName}: ${message}`;
|
98
|
+
}
|
83
99
|
|
84
100
|
/**
|
85
101
|
* Schema for component config
|
@@ -103,6 +119,10 @@ function isObject(option) {
|
|
103
119
|
* @property {string[]} required - List of required config fields
|
104
120
|
* @property {string} errorMessage - Error message when required config fields not provided
|
105
121
|
*/
|
122
|
+
/**
|
123
|
+
* @typedef ComponentWithModuleName
|
124
|
+
* @property {string} moduleName - Name of the component
|
125
|
+
*/
|
106
126
|
|
107
127
|
function normaliseDataset(Component, dataset) {
|
108
128
|
const out = {};
|
@@ -140,30 +160,85 @@ class ElementError extends GOVUKFrontendError {
|
|
140
160
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
141
161
|
if (typeof messageOrOptions === 'object') {
|
142
162
|
const {
|
143
|
-
|
163
|
+
component,
|
144
164
|
identifier,
|
145
165
|
element,
|
146
166
|
expectedType
|
147
167
|
} = messageOrOptions;
|
148
|
-
message =
|
168
|
+
message = identifier;
|
149
169
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
170
|
+
message = formatErrorMessage(component, message);
|
150
171
|
}
|
151
172
|
super(message);
|
152
173
|
this.name = 'ElementError';
|
153
174
|
}
|
154
175
|
}
|
176
|
+
class InitError extends GOVUKFrontendError {
|
177
|
+
constructor(componentOrMessage) {
|
178
|
+
const message = typeof componentOrMessage === 'string' ? componentOrMessage : formatErrorMessage(componentOrMessage, `Root element (\`$root\`) already initialised`);
|
179
|
+
super(message);
|
180
|
+
this.name = 'InitError';
|
181
|
+
}
|
182
|
+
}
|
183
|
+
/**
|
184
|
+
* @typedef {import('../common/index.mjs').ComponentWithModuleName} ComponentWithModuleName
|
185
|
+
*/
|
155
186
|
|
156
187
|
class GOVUKFrontendComponent {
|
157
|
-
|
158
|
-
|
188
|
+
/**
|
189
|
+
* Returns the root element of the component
|
190
|
+
*
|
191
|
+
* @protected
|
192
|
+
* @returns {RootElementType} - the root element of component
|
193
|
+
*/
|
194
|
+
get $root() {
|
195
|
+
return this._$root;
|
159
196
|
}
|
160
|
-
|
197
|
+
constructor($root) {
|
198
|
+
this._$root = void 0;
|
199
|
+
const childConstructor = this.constructor;
|
200
|
+
if (typeof childConstructor.moduleName !== 'string') {
|
201
|
+
throw new InitError(`\`moduleName\` not defined in component`);
|
202
|
+
}
|
203
|
+
if (!($root instanceof childConstructor.elementType)) {
|
204
|
+
throw new ElementError({
|
205
|
+
element: $root,
|
206
|
+
component: childConstructor,
|
207
|
+
identifier: 'Root element (`$root`)',
|
208
|
+
expectedType: childConstructor.elementType.name
|
209
|
+
});
|
210
|
+
} else {
|
211
|
+
this._$root = $root;
|
212
|
+
}
|
213
|
+
childConstructor.checkSupport();
|
214
|
+
this.checkInitialised();
|
215
|
+
const moduleName = childConstructor.moduleName;
|
216
|
+
this.$root.setAttribute(`data-${moduleName}-init`, '');
|
217
|
+
}
|
218
|
+
checkInitialised() {
|
219
|
+
const constructor = this.constructor;
|
220
|
+
const moduleName = constructor.moduleName;
|
221
|
+
if (moduleName && isInitialised(this.$root, moduleName)) {
|
222
|
+
throw new InitError(constructor);
|
223
|
+
}
|
224
|
+
}
|
225
|
+
static checkSupport() {
|
161
226
|
if (!isSupported()) {
|
162
227
|
throw new SupportError();
|
163
228
|
}
|
164
229
|
}
|
165
230
|
}
|
166
231
|
|
232
|
+
/**
|
233
|
+
* @typedef ChildClass
|
234
|
+
* @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component
|
235
|
+
*/
|
236
|
+
|
237
|
+
/**
|
238
|
+
* @typedef {typeof GOVUKFrontendComponent & ChildClass} ChildClassConstructor
|
239
|
+
*/
|
240
|
+
GOVUKFrontendComponent.elementType = HTMLElement;
|
241
|
+
|
167
242
|
class I18n {
|
168
243
|
constructor(translations = {}, config = {}) {
|
169
244
|
var _config$locale;
|
@@ -373,12 +448,11 @@ I18n.pluralRules = {
|
|
373
448
|
*/
|
374
449
|
class Accordion extends GOVUKFrontendComponent {
|
375
450
|
/**
|
376
|
-
* @param {Element | null} $
|
451
|
+
* @param {Element | null} $root - HTML element to use for accordion
|
377
452
|
* @param {AccordionConfig} [config] - Accordion config
|
378
453
|
*/
|
379
|
-
constructor($
|
380
|
-
super();
|
381
|
-
this.$module = void 0;
|
454
|
+
constructor($root, config = {}) {
|
455
|
+
super($root);
|
382
456
|
this.config = void 0;
|
383
457
|
this.i18n = void 0;
|
384
458
|
this.controlsClass = 'govuk-accordion__controls';
|
@@ -404,20 +478,12 @@ class Accordion extends GOVUKFrontendComponent {
|
|
404
478
|
this.$showAllButton = null;
|
405
479
|
this.$showAllIcon = null;
|
406
480
|
this.$showAllText = null;
|
407
|
-
|
408
|
-
throw new ElementError({
|
409
|
-
componentName: 'Accordion',
|
410
|
-
element: $module,
|
411
|
-
identifier: 'Root element (`$module`)'
|
412
|
-
});
|
413
|
-
}
|
414
|
-
this.$module = $module;
|
415
|
-
this.config = mergeConfigs(Accordion.defaults, config, normaliseDataset(Accordion, $module.dataset));
|
481
|
+
this.config = mergeConfigs(Accordion.defaults, config, normaliseDataset(Accordion, this.$root.dataset));
|
416
482
|
this.i18n = new I18n(this.config.i18n);
|
417
|
-
const $sections = this.$
|
483
|
+
const $sections = this.$root.querySelectorAll(`.${this.sectionClass}`);
|
418
484
|
if (!$sections.length) {
|
419
485
|
throw new ElementError({
|
420
|
-
|
486
|
+
component: Accordion,
|
421
487
|
identifier: `Sections (\`<div class="${this.sectionClass}">\`)`
|
422
488
|
});
|
423
489
|
}
|
@@ -437,7 +503,7 @@ class Accordion extends GOVUKFrontendComponent {
|
|
437
503
|
const $accordionControls = document.createElement('div');
|
438
504
|
$accordionControls.setAttribute('class', this.controlsClass);
|
439
505
|
$accordionControls.appendChild(this.$showAllButton);
|
440
|
-
this.$
|
506
|
+
this.$root.insertBefore($accordionControls, this.$root.firstChild);
|
441
507
|
this.$showAllText = document.createElement('span');
|
442
508
|
this.$showAllText.classList.add(this.showAllTextClass);
|
443
509
|
this.$showAllButton.appendChild(this.$showAllText);
|
@@ -451,7 +517,7 @@ class Accordion extends GOVUKFrontendComponent {
|
|
451
517
|
const $header = $section.querySelector(`.${this.sectionHeaderClass}`);
|
452
518
|
if (!$header) {
|
453
519
|
throw new ElementError({
|
454
|
-
|
520
|
+
component: Accordion,
|
455
521
|
identifier: `Section headers (\`<div class="${this.sectionHeaderClass}">\`)`
|
456
522
|
});
|
457
523
|
}
|
@@ -467,19 +533,19 @@ class Accordion extends GOVUKFrontendComponent {
|
|
467
533
|
const $summary = $header.querySelector(`.${this.sectionSummaryClass}`);
|
468
534
|
if (!$heading) {
|
469
535
|
throw new ElementError({
|
470
|
-
|
536
|
+
component: Accordion,
|
471
537
|
identifier: `Section heading (\`.${this.sectionHeadingClass}\`)`
|
472
538
|
});
|
473
539
|
}
|
474
540
|
if (!$span) {
|
475
541
|
throw new ElementError({
|
476
|
-
|
542
|
+
component: Accordion,
|
477
543
|
identifier: `Section button placeholder (\`<span class="${this.sectionButtonClass}">\`)`
|
478
544
|
});
|
479
545
|
}
|
480
546
|
const $button = document.createElement('button');
|
481
547
|
$button.setAttribute('type', 'button');
|
482
|
-
$button.setAttribute('aria-controls', `${this.$
|
548
|
+
$button.setAttribute('aria-controls', `${this.$root.id}-content-${index + 1}`);
|
483
549
|
for (const attr of Array.from($span.attributes)) {
|
484
550
|
if (attr.name !== 'id') {
|
485
551
|
$button.setAttribute(attr.name, attr.value);
|
@@ -553,7 +619,7 @@ class Accordion extends GOVUKFrontendComponent {
|
|
553
619
|
const $content = $section.querySelector(`.${this.sectionContentClass}`);
|
554
620
|
if (!$content) {
|
555
621
|
throw new ElementError({
|
556
|
-
|
622
|
+
component: Accordion,
|
557
623
|
identifier: `Section content (\`<div class="${this.sectionContentClass}">\`)`
|
558
624
|
});
|
559
625
|
}
|