Skip to content

Commit af1869f

Browse files
committed
add missing check of params.fieldset.describedBy
1 parent d20b0c5 commit af1869f

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

nhsuk_frontend_jinja/nhsuk/components/checkboxes/template.jinja

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
{#- a record of other elements that we need to associate with the input using
1212
aria-describedby – for example hints or error messages -#}
1313
{% set ns = namespace(describedBy = "") %}
14+
{%- if params.fieldset.describedBy -%}
15+
{% set ns.describedBy = params.fieldset.describedBy %}
16+
{%- endif -%}
1417

1518
{#- Jinja compatibility - avoid referencing params.items/params.values directly
1619
as it clashes with dict.items() and dict.values() -#}

nhsuk_frontend_jinja/nhsuk/components/date-input/template.jinja

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
{#- a record of other elements that we need to associate with the input using
1212
aria-describedby – for example hints or error messages -#}
13-
{% set ns = namespace(describedBy = "") %}
13+
{% set ns = namespace() %}
14+
{%- set ns.describedBy = params.fieldset.describedBy if params.fieldset.describedBy else "" -%}
1415

1516
{% if "items" in params %}
1617
{% set dateInputItems = params["items"] %}

nhsuk_frontend_jinja/nhsuk/components/radios/template.jinja

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
{#- a record of other elements that we need to associate with the input using
1616
aria-describedby – for example hints or error messages -#}
17-
{% set ns = namespace(describedBy = "") %}
17+
{%- set ns = namespace() -%}
18+
{%- set ns.describedBy = params.fieldset.describedBy if params.fieldset.describedBy else "" -%}
1819

1920
{% set isConditional = items | map(attribute="conditional", default={}) | selectattr("html") | list | length %}
2021

0 commit comments

Comments
 (0)