Skip to content

Commit

Permalink
Use Character count formGroup as module wrapper
Browse files Browse the repository at this point in the history
This removes the wrapping data-module `<div>` and puts all attributes on the Textarea `formGroup` instead
  • Loading branch information
colinrotherham committed Feb 16, 2024
1 parent cfc0a4a commit 3c0b968
Showing 1 changed file with 28 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,33 +90,31 @@
{% set attributesHtml = attributesHtml + " " + name | escape + '="' + value | escape + '"' %}
{% endfor -%}

<div class="govuk-character-count">
{{ govukTextarea({
id: params.id,
name: params.name,
describedBy: params.id + '-info',
rows: params.rows,
spellcheck: params.spellcheck,
value: params.value,
formGroup: {
classes: params.formGroup.classes,
attributes: attributesHtml,
beforeInput: params.formGroup.beforeInput,
afterInput: {
html: countMessageHtml
}
},
classes: 'govuk-js-character-count' + (' ' + params.classes if params.classes),
label: {
html: params.label.html,
text: params.label.text,
classes: params.label.classes,
isPageHeading: params.label.isPageHeading,
attributes: params.label.attributes,
for: params.id
},
hint: params.hint,
errorMessage: params.errorMessage,
attributes: params.attributes
}) | trim }}
</div>
{{ govukTextarea({
id: params.id,
name: params.name,
describedBy: params.id + '-info',
rows: params.rows,
spellcheck: params.spellcheck,
value: params.value,
formGroup: {
classes: 'govuk-character-count' + (' ' + params.formGroup.classes if params.formGroup.classes),
attributes: attributesHtml,
beforeInput: params.formGroup.beforeInput,
afterInput: {
html: countMessageHtml
}
},
classes: 'govuk-js-character-count' + (' ' + params.classes if params.classes),
label: {
html: params.label.html,
text: params.label.text,
classes: params.label.classes,
isPageHeading: params.label.isPageHeading,
attributes: params.label.attributes,
for: params.id
},
hint: params.hint,
errorMessage: params.errorMessage,
attributes: params.attributes
}) | trim }}

0 comments on commit 3c0b968

Please sign in to comment.