-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow attributes
option on form groups
#4565
Conversation
📋 StatsFile sizes
Modules
View stats and visualisations on the review app Action run for f3a69e2 |
Other changes to npm packagediff --git a/packages/govuk-frontend/dist/govuk/components/character-count/macro-options.json b/packages/govuk-frontend/dist/govuk/components/character-count/macro-options.json
index b6e105fd5..a740bfcee 100644
--- a/packages/govuk-frontend/dist/govuk/components/character-count/macro-options.json
+++ b/packages/govuk-frontend/dist/govuk/components/character-count/macro-options.json
@@ -73,6 +73,12 @@
"type": "string",
"required": false,
"description": "Classes to add to the form group (for example to show error state for the whole group)."
+ },
+ {
+ "name": "attributes",
+ "type": "object",
+ "required": false,
+ "description": "HTML attributes (for example data attributes) to add to the form group."
}
]
},
diff --git a/packages/govuk-frontend/dist/govuk/components/checkboxes/macro-options.json b/packages/govuk-frontend/dist/govuk/components/checkboxes/macro-options.json
index 4c284113a..8da436cb0 100644
--- a/packages/govuk-frontend/dist/govuk/components/checkboxes/macro-options.json
+++ b/packages/govuk-frontend/dist/govuk/components/checkboxes/macro-options.json
@@ -37,6 +37,12 @@
"type": "string",
"required": false,
"description": "Classes to add to the form group (for example to show error state for the whole group)."
+ },
+ {
+ "name": "attributes",
+ "type": "object",
+ "required": false,
+ "description": "HTML attributes (for example data attributes) to add to the form group."
}
]
},
diff --git a/packages/govuk-frontend/dist/govuk/components/checkboxes/template.njk b/packages/govuk-frontend/dist/govuk/components/checkboxes/template.njk
index 49ebb9bd2..2daefaf04 100644
--- a/packages/govuk-frontend/dist/govuk/components/checkboxes/template.njk
+++ b/packages/govuk-frontend/dist/govuk/components/checkboxes/template.njk
@@ -103,7 +103,7 @@
</div>
{% endset -%}
-<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
+<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}" {%- for attribute, value in params.formGroup.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
{% if params.fieldset %}
{% call govukFieldset({
describedBy: describedBy,
diff --git a/packages/govuk-frontend/dist/govuk/components/date-input/macro-options.json b/packages/govuk-frontend/dist/govuk/components/date-input/macro-options.json
index a67c7355e..8b6545b9a 100644
--- a/packages/govuk-frontend/dist/govuk/components/date-input/macro-options.json
+++ b/packages/govuk-frontend/dist/govuk/components/date-input/macro-options.json
@@ -92,6 +92,12 @@
"type": "string",
"required": false,
"description": "Classes to add to the form group (for example to show error state for the whole group)."
+ },
+ {
+ "name": "attributes",
+ "type": "object",
+ "required": false,
+ "description": "HTML attributes (for example data attributes) to add to the form group."
}
]
},
diff --git a/packages/govuk-frontend/dist/govuk/components/date-input/template.njk b/packages/govuk-frontend/dist/govuk/components/date-input/template.njk
index bd5943577..42aa0d4c3 100644
--- a/packages/govuk-frontend/dist/govuk/components/date-input/template.njk
+++ b/packages/govuk-frontend/dist/govuk/components/date-input/template.njk
@@ -76,7 +76,7 @@
</div>
{% endset -%}
-<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
+<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}" {%- for attribute, value in params.formGroup.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
{% if params.fieldset %}
{#- We override the fieldset's role to 'group' because otherwise JAWS does not
announce the description for a fieldset comprised of text inputs, but
diff --git a/packages/govuk-frontend/dist/govuk/components/file-upload/macro-options.json b/packages/govuk-frontend/dist/govuk/components/file-upload/macro-options.json
index ab831978e..6e51af747 100644
--- a/packages/govuk-frontend/dist/govuk/components/file-upload/macro-options.json
+++ b/packages/govuk-frontend/dist/govuk/components/file-upload/macro-options.json
@@ -61,6 +61,12 @@
"type": "string",
"required": false,
"description": "Classes to add to the form group (for example to show error state for the whole group)."
+ },
+ {
+ "name": "attributes",
+ "type": "object",
+ "required": false,
+ "description": "HTML attributes (for example data attributes) to add to the form group."
}
]
},
diff --git a/packages/govuk-frontend/dist/govuk/components/file-upload/template.njk b/packages/govuk-frontend/dist/govuk/components/file-upload/template.njk
index e830e816f..ee5cd01db 100644
--- a/packages/govuk-frontend/dist/govuk/components/file-upload/template.njk
+++ b/packages/govuk-frontend/dist/govuk/components/file-upload/template.njk
@@ -5,7 +5,7 @@
{#- a record of other elements that we need to associate with the input using
aria-describedby – for example hints or error messages -#}
{% set describedBy = params.describedBy if params.describedBy else "" %}
-<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
+<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}" {%- for attribute, value in params.formGroup.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
{{ govukLabel({
html: params.label.html,
text: params.label.text,
diff --git a/packages/govuk-frontend/dist/govuk/components/input/macro-options.json b/packages/govuk-frontend/dist/govuk/components/input/macro-options.json
index a42e49157..018f8d1dc 100644
--- a/packages/govuk-frontend/dist/govuk/components/input/macro-options.json
+++ b/packages/govuk-frontend/dist/govuk/components/input/macro-options.json
@@ -137,6 +137,12 @@
"type": "string",
"required": false,
"description": "Classes to add to the form group (for example to show error state for the whole group)."
+ },
+ {
+ "name": "attributes",
+ "type": "object",
+ "required": false,
+ "description": "HTML attributes (for example data attributes) to add to the form group."
}
]
},
diff --git a/packages/govuk-frontend/dist/govuk/components/input/template.njk b/packages/govuk-frontend/dist/govuk/components/input/template.njk
index 12c96f734..9fea708e4 100644
--- a/packages/govuk-frontend/dist/govuk/components/input/template.njk
+++ b/packages/govuk-frontend/dist/govuk/components/input/template.njk
@@ -6,7 +6,7 @@
aria-describedby – for example hints or error messages -#}
{% set describedBy = params.describedBy if params.describedBy else "" -%}
-<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
+<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}" {%- for attribute, value in params.formGroup.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
{{ govukLabel({
html: params.label.html,
text: params.label.text,
diff --git a/packages/govuk-frontend/dist/govuk/components/radios/macro-options.json b/packages/govuk-frontend/dist/govuk/components/radios/macro-options.json
index 7bc6dfa26..8af83b280 100644
--- a/packages/govuk-frontend/dist/govuk/components/radios/macro-options.json
+++ b/packages/govuk-frontend/dist/govuk/components/radios/macro-options.json
@@ -31,6 +31,12 @@
"type": "string",
"required": false,
"description": "Classes to add to the form group (for example to show error state for the whole group)."
+ },
+ {
+ "name": "attributes",
+ "type": "object",
+ "required": false,
+ "description": "HTML attributes (for example data attributes) to add to the form group."
}
]
},
diff --git a/packages/govuk-frontend/dist/govuk/components/radios/template.njk b/packages/govuk-frontend/dist/govuk/components/radios/template.njk
index 7fe0ab4fd..57fbc7941 100644
--- a/packages/govuk-frontend/dist/govuk/components/radios/template.njk
+++ b/packages/govuk-frontend/dist/govuk/components/radios/template.njk
@@ -93,7 +93,7 @@
</div>
{% endset -%}
-<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
+<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}" {%- for attribute, value in params.formGroup.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
{% if params.fieldset %}
{% call govukFieldset({
describedBy: describedBy,
diff --git a/packages/govuk-frontend/dist/govuk/components/select/macro-options.json b/packages/govuk-frontend/dist/govuk/components/select/macro-options.json
index 9f7ba0223..838f05e26 100644
--- a/packages/govuk-frontend/dist/govuk/components/select/macro-options.json
+++ b/packages/govuk-frontend/dist/govuk/components/select/macro-options.json
@@ -99,6 +99,12 @@
"type": "string",
"required": false,
"description": "Classes to add to the form group (for example to show error state for the whole group)."
+ },
+ {
+ "name": "attributes",
+ "type": "object",
+ "required": false,
+ "description": "HTML attributes (for example data attributes) to add to the form group."
}
]
},
diff --git a/packages/govuk-frontend/dist/govuk/components/select/template.njk b/packages/govuk-frontend/dist/govuk/components/select/template.njk
index e3fd5ceca..9f04c83b7 100644
--- a/packages/govuk-frontend/dist/govuk/components/select/template.njk
+++ b/packages/govuk-frontend/dist/govuk/components/select/template.njk
@@ -5,7 +5,7 @@
{#- a record of other elements that we need to associate with the input using
aria-describedby – for example hints or error messages -#}
{% set describedBy = params.describedBy if params.describedBy else "" %}
-<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
+<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}" {%- for attribute, value in params.formGroup.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
{{ govukLabel({
html: params.label.html,
text: params.label.text,
diff --git a/packages/govuk-frontend/dist/govuk/components/textarea/macro-options.json b/packages/govuk-frontend/dist/govuk/components/textarea/macro-options.json
index f75119d16..16249f7bb 100644
--- a/packages/govuk-frontend/dist/govuk/components/textarea/macro-options.json
+++ b/packages/govuk-frontend/dist/govuk/components/textarea/macro-options.json
@@ -73,6 +73,12 @@
"type": "string",
"required": false,
"description": "Classes to add to the form group (for example to show error state for the whole group)."
+ },
+ {
+ "name": "attributes",
+ "type": "object",
+ "required": false,
+ "description": "HTML attributes (for example data attributes) to add to the form group."
}
]
},
diff --git a/packages/govuk-frontend/dist/govuk/components/textarea/template.njk b/packages/govuk-frontend/dist/govuk/components/textarea/template.njk
index 1042b4ad7..660e86363 100644
--- a/packages/govuk-frontend/dist/govuk/components/textarea/template.njk
+++ b/packages/govuk-frontend/dist/govuk/components/textarea/template.njk
@@ -5,7 +5,7 @@
{#- a record of other elements that we need to associate with the input using
aria-describedby – for example hints or error messages -#}
{% set describedBy = params.describedBy if params.describedBy else "" %}
-<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
+<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}" {%- for attribute, value in params.formGroup.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
{{ govukLabel({
html: params.label.html,
text: params.label.text,
Action run for f3a69e2 |
7715258
to
bdce332
Compare
bdce332
to
1aaea98
Compare
1aaea98
to
3043764
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks neat to me. 🙌🏻 Thinking it's worth adding a CHANGELOG entry before we merge, do you mind adding one, please? 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💪🏻
Thanks @owenatgov Just going to rebase to pick up the new Percy diff changes |
ce5d4bb
to
f3a69e2
Compare
This PR adds support for
formGroup: { attributes: {} }
It's part of a fix suggested by @querkmachine in #2893 (comment) and follows the thinking in:
This is a supporting change to enable #4566