Fix aria on collapsed checkboxes fieldset

The fieldset that wraps the collapsible checkboxes
has an aria-describedby to make the summary its
accessible description.

This needs to point to the id of the summary but
the summary didn't have one.

These changes add the id and fix a fixture in the
tests for this module.
This commit is contained in:
Tom Byers
2021-02-25 14:00:16 +00:00
parent 82318387de
commit 7b67fc5f32
2 changed files with 23 additions and 4 deletions

View File

@@ -20,12 +20,14 @@
}[field] || `No ${field}s`)
};
Summary.prototype.addContent = function() {
const $hint = this.module.$formGroup.find('.govuk-hint');
this.$text = $(`<p class="selection-summary__text" />`);
if (this.fieldLabel === 'folder') { this.$text.addClass('selection-summary__text--folders'); }
this.$el.attr('id', $hint.attr('id'));
this.$el.append(this.$text);
this.module.$formGroup.find('.govuk-hint').remove();
$hint.remove();
};
Summary.prototype.update = function(selection) {
let template;