Skip to content

Commit

Permalink
Allow attributes option on form groups
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Dec 14, 2023
1 parent b44d7b0 commit bdce332
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ params:
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.
- name: classes
type: string
required: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ params:
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.
- name: idPrefix
type: string
required: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ params:
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.
- name: fieldset
type: object
required: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ params:
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.
- name: classes
type: string
required: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions packages/govuk-frontend/src/govuk/components/input/input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ params:
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.
- name: classes
type: string
required: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ params:
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.
- name: idPrefix
type: string
required: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ params:
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.
- name: classes
type: string
required: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ params:
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.
- name: classes
type: string
required: false
Expand Down

0 comments on commit bdce332

Please sign in to comment.