Repository: LandRegistry/govuk-frontend-jinja (language: python)

Issue:
Updates for GOV.UK Frontend v4.6.0



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml
index d8073956..af9b1f2e 100644
--- a/.github/workflows/python-package.yml
+++ b/.github/workflows/python-package.yml
@@ -46,5 +46,5 @@ jobs:
       run: |
         (cd tests/utils && nohup python -m flask run --port 3000 &)
         wait-for-it localhost:3000
-        ./govuk-frontend-diff http://localhost:3000 --govuk-frontend-version=v4.5.0 --ci
+        ./govuk-frontend-diff http://localhost:3000 --govuk-frontend-version=v4.6.0 --ci
 
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 17bfca15..9e628068 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,15 @@ All notable changes to this project will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
-## [Unreleased](https://github.com/LandRegistry/govuk-frontend-jinja/compare/2.5.0...main)
+## [Unreleased](https://github.com/LandRegistry/govuk-frontend-jinja/compare/2.6.0...main)
+
+## [2.6.0](https://github.com/LandRegistry/govuk-frontend-jinja/releases/tag/2.6.0) - 25/04/2023
+
+### Added
+
+- [GOV.UK Frontend v4.6.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.6.0) support
+
+Thanks to [Cameron Lamb](https://github.com/jafacakes2011)
 
 ## [2.5.0](https://github.com/LandRegistry/govuk-frontend-jinja/releases/tag/2.5.0) - 14/02/2023
 
@@ -32,7 +40,7 @@ Thanks to [Leo Hemstead](https://github.com/leohemsted) and [Andy Mantell](https
 - [GOV.UK Frontend v4.2.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.2.0) support
 - [Pagination component](https://design-system.service.gov.uk/components/pagination/)
 
-Thanks to [SentientHousePlant](https://github.com/SentientHousePlant)
+Thanks to [Indigo Harrington](https://github.com/SentientHousePlant)
 
 ## [2.2.0](https://github.com/LandRegistry/govuk-frontend-jinja/releases/tag/2.2.0) - 18/05/2022
 
diff --git a/README.md b/README.md
index eeb0c364..5394dc99 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
 # GOV.UK Frontend Jinja Macros
 
 [![PyPI version](https://badge.fury.io/py/govuk-frontend-jinja.svg)](https://pypi.org/project/govuk-frontend-jinja/)
-![govuk-frontend 4.5.0](https://img.shields.io/badge/govuk--frontend%20version-4.5.0-005EA5?logo=gov.uk&style=flat)
+![govuk-frontend 4.6.0](https://img.shields.io/badge/govuk--frontend%20version-4.6.0-005EA5?logo=gov.uk&style=flat)
 [![Python package](https://github.com/LandRegistry/govuk-frontend-jinja/actions/workflows/python-package.yml/badge.svg)](https://github.com/LandRegistry/govuk-frontend-jinja/actions/workflows/python-package.yml)
 
 **GOV.UK Frontend Jinja is a [community tool](https://design-system.service.gov.uk/community/resources-and-tools/) of the [GOV.UK Design System](https://design-system.service.gov.uk/). The Design System team is not responsible for it and cannot support you with using it. Contact the [maintainers](#contributors) directly if you need [help](#support) or you want to request a feature.**
@@ -16,6 +16,7 @@ The following table shows the version of GOV.UK Frontend Jinja that you should u
 
 | GOV.UK Frontend Jinja Version | Target GOV.UK Frontend Version |
 | ----------------------------- | ------------------------------ |
+| [2.6.0](https://github.com/LandRegistry/govuk-frontend-jinja/releases/tag/2.6.0) | [4.6.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.6.0) |
 | [2.5.0](https://github.com/LandRegistry/govuk-frontend-jinja/releases/tag/2.5.0) | [4.5.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.5.0) |
 | [2.4.0](https://github.com/LandRegistry/govuk-frontend-jinja/releases/tag/2.4.0) | [4.4.1](https://github.com/alphagov/govuk-frontend/releases/tag/v4.4.1) |
 | [2.3.0](https://github.com/LandRegistry/govuk-frontend-jinja/releases/tag/2.3.0) | [4.2.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.2.0) |
@@ -109,6 +110,8 @@ How to update this package following a new release of GOV.UK Frontend:
 - [Matt Shaw](https://github.com/matthew-shaw) (Primary maintainer)
 - [Andy Mantell](https://github.com/andymantell) (Original author)
 
+See the full list of [contributors on GitHub](https://github.com/LandRegistry/govuk-frontend-jinja/graphs/contributors)
+
 ## Support
 
 This software is provided _"as-is"_ without warranty. Support is provided on a _"best endeavours"_ basis by the maintainers and open source community.
diff --git a/govuk_frontend_jinja/templates/components/accordion/macro.html b/govuk_frontend_jinja/templates/components/accordion/macro.html
index 312bef7c..bcb84f64 100644
--- a/govuk_frontend_jinja/templates/components/accordion/macro.html
+++ b/govuk_frontend_jinja/templates/components/accordion/macro.html
@@ -6,6 +6,7 @@
   {%- if params.hideAllSectionsText %} data-i18n.hide-all-sections="{{ params.hideAllSectionsText | escape }}"{% endif %}
   {%- if params.hideSectionText %} data-i18n.hide-section="{{ params.hideSectionText | escape }}"{% endif %}
   {%- if params.hideSectionAriaLabelText %} data-i18n.hide-section-aria-label="{{ params.hideSectionAriaLabelText | escape }}"{% endif %}
+  {%- if params.rememberExpanded is not undefined %} data-remember-expanded="{{ params.rememberExpanded | escape | lower }}"{% endif %}
   {%- if params.showAllSectionsText %} data-i18n.show-all-sections="{{ params.showAllSectionsText | escape }}"{% endif %}
   {%- if params.showSectionText %} data-i18n.show-section="{{ params.showSectionText | escape }}"{% endif %}
   {%- if params.showSectionAriaLabelText %} data-i18n.show-section-aria-label="{{ params.showSectionAriaLabelText | escape }}"{% endif %}
diff --git a/govuk_frontend_jinja/templates/components/button/macro.html b/govuk_frontend_jinja/templates/components/button/macro.html
index 7252789e..9bb41471 100644
--- a/govuk_frontend_jinja/templates/components/button/macro.html
+++ b/govuk_frontend_jinja/templates/components/button/macro.html
@@ -34,7 +34,7 @@
 
 {#- Define common attributes that we can use across all element types #}
 
-{%- set commonAttributes %} class="{{ classNames }}" data-module="govuk-button"{% for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{attribute}}="{{value}}"{% endfor %}{% endset %}
+{%- set commonAttributes %} class="{{ classNames }}" data-module="govuk-button"{% for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{attribute}}="{{value}}"{% endfor %}{% if params.id %} id="{{ params.id }}"{% endif %}{% endset %}
 
 {#- Define common attributes we can use for both button and input types #}
 
diff --git a/govuk_frontend_jinja/templates/components/date-input/macro.html b/govuk_frontend_jinja/templates/components/date-input/macro.html
index c002da4d..5c5cb275 100644
--- a/govuk_frontend_jinja/templates/components/date-input/macro.html
+++ b/govuk_frontend_jinja/templates/components/date-input/macro.html
@@ -5,7 +5,7 @@
 {% from "govuk_frontend_jinja/components/input/macro.html" import govukInput %}
 
 {#- a record of other elements that we need to associate with the input using
-   aria-describedby – for example hints or error messages -#}
+  aria-describedby – for example hints or error messages -#}
 {% set ns = namespace() %}
 {% set ns.describedBy = params.fieldset.describedBy if params.fieldset and params.fieldset.describedBy else "" %}
 
diff --git a/govuk_frontend_jinja/templates/components/file-upload/macro.html b/govuk_frontend_jinja/templates/components/file-upload/macro.html
index 34848ae7..861d850a 100644
--- a/govuk_frontend_jinja/templates/components/file-upload/macro.html
+++ b/govuk_frontend_jinja/templates/components/file-upload/macro.html
@@ -4,7 +4,7 @@
 {% from "govuk_frontend_jinja/components/label/macro.html" import govukLabel %}
 
 {#- a record of other elements that we need to associate with the input using
-   aria-describedby – for example hints or error messages -#}
+  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 and params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
   {{ govukLabel({
@@ -40,6 +40,7 @@
 {% endif %}
   <input class="govuk-file-upload {%- if params.classes %} {{ params.classes }}{% endif %} {%- if params.errorMessage %} govuk-file-upload--error{% endif %}" id="{{ params.id }}" name="{{ params.name }}" type="file"
   {%- if params.value %} value="{{ params.value }}"{% endif %}
+  {%- if params.disabled %} disabled{% endif %}
   {%- if describedBy %} aria-describedby="{{ describedBy }}"{% endif %}
   {%- for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{attribute}}="{{value}}"{% endfor %}>
 </div>
diff --git a/govuk_frontend_jinja/templates/components/header/macro.html b/govuk_frontend_jinja/templates/components/header/macro.html
index eae3970b..6de10ad3 100644
--- a/govuk_frontend_jinja/templates/components/header/macro.html
+++ b/govuk_frontend_jinja/templates/components/header/macro.html
@@ -36,7 +36,7 @@
           </svg>
           <!--<![endif]-->
           <!--[if IE 8]>
-          <img src="{{ params.assetsPath | default('/assets/images') }}/govuk-logotype-crown.png" class="govuk-header__logotype-crown-fallback-image" width="36" height="32">
+          <img src="{{ params.assetsPath | default('/assets/images') }}/govuk-logotype-crown.png" class="govuk-header__logotype-crown-fallback-image" width="36" height="32" alt="">
           <![endif]-->
           <span class="govuk-header__logotype-text">
             GOV.UK
diff --git a/govuk_frontend_jinja/templates/components/input/macro.html b/govuk_frontend_jinja/templates/components/input/macro.html
index d8bf2f02..37f66815 100644
--- a/govuk_frontend_jinja/templates/components/input/macro.html
+++ b/govuk_frontend_jinja/templates/components/input/macro.html
@@ -4,7 +4,7 @@
 {% from "govuk_frontend_jinja/components/label/macro.html" import govukLabel %}
 
 {#- a record of other elements that we need to associate with the input using
-   aria-describedby – for example hints or error messages -#}
+  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 and params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
   {{ govukLabel({
@@ -50,6 +50,7 @@
   <input class="govuk-input {%- if params.classes %} {{ params.classes }}{% endif %} {%- if params.errorMessage %} govuk-input--error{% endif %}" id="{{ params.id }}" name="{{ params.name }}" type="{{ params.type | default('text') }}"
   {%- if (params.spellcheck == false) or (params.spellcheck == true) %} spellcheck="{{ params.spellcheck | lower }}"{% endif %}
   {%- if params.value %} value="{{ params.value}}"{% endif %}
+  {%- if params.disabled %} disabled{% endif %}
   {%- if describedBy %} aria-describedby="{{ describedBy }}"{% endif %}
   {%- if params.autocomplete %} autocomplete="{{ params.autocomplete}}"{% endif %}
   {%- if params.pattern %} pattern="{{ params.pattern }}"{% endif %}
diff --git a/govuk_frontend_jinja/templates/components/radios/macro.html b/govuk_frontend_jinja/templates/components/radios/macro.html
index 0870b6f2..26d69f06 100644
--- a/govuk_frontend_jinja/templates/components/radios/macro.html
+++ b/govuk_frontend_jinja/templates/components/radios/macro.html
@@ -5,13 +5,13 @@
 {% from "govuk_frontend_jinja/components/label/macro.html" import govukLabel %}
 
 {#- If an id 'prefix' is not passed, fall back to using the name attribute
-   instead. We need this for error messages and hints as well -#}
+  instead. We need this for error messages and hints as well -#}
 {% set idPrefix = params.idPrefix if params.idPrefix else params.name %}
 
 {% set ns = namespace() %}
 
 {#- a record of other elements that we need to associate with the input using
-   aria-describedby – for example hints or error messages -#}
+  aria-describedby – for example hints or error messages -#}
 {% set ns.describedBy = params.fieldset.describedBy if params.fieldset and params.fieldset.describedBy else "" %}
 
 {#- Capture the HTML so we can optionally nest it in a fieldset -#}
diff --git a/govuk_frontend_jinja/templates/components/select/macro.html b/govuk_frontend_jinja/templates/components/select/macro.html
index 90aea06b..8a1b7d11 100644
--- a/govuk_frontend_jinja/templates/components/select/macro.html
+++ b/govuk_frontend_jinja/templates/components/select/macro.html
@@ -4,7 +4,7 @@
 {% from "govuk_frontend_jinja/components/label/macro.html" import govukLabel %}
 
 {#- a record of other elements that we need to associate with the input using
-   aria-describedby – for example hints or error messages -#}
+  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 and params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
 {% if params.label %}
@@ -41,7 +41,10 @@
   }) | indent(2) | trim }}
 {% endif %}
   <select class="govuk-select
-    {%- if params.classes %} {{ params.classes }}{% endif %}{%- if params.errorMessage %} govuk-select--error{% endif %}" id="{{ params.id }}" name="{{ params.name }}" {%- if describedBy %} aria-describedby="{{ describedBy }}"{% endif %} {%- for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{ attribute }}="{{ value }}"{% endfor %}>
+    {%- if params.classes %} {{ params.classes }}{% endif %}{%- if params.errorMessage %} govuk-select--error{% endif %}" id="{{ params.id }}" name="{{ params.name }}"
+    {%- if params.disabled %} disabled{% endif %}
+    {%- if describedBy %} aria-describedby="{{ describedBy }}"{% endif %}
+    {%- for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{ attribute }}="{{ value }}"{% endfor %}>
     {% if 'items' in params and params['items'] | length %}
       {% for item in params['items'] %}
         {% if item %}
diff --git a/govuk_frontend_jinja/templates/components/tabs/macro.html b/govuk_frontend_jinja/templates/components/tabs/macro.html
index 0de3a073..d478f816 100644
--- a/govuk_frontend_jinja/templates/components/tabs/macro.html
+++ b/govuk_frontend_jinja/templates/components/tabs/macro.html
@@ -1,6 +1,6 @@
 {% macro govukTabs(params) %}
 {#- If an id 'prefix' is not passed, fall back to using the name attribute
-   instead. We need this for error messages and hints as well -#}
+  instead. We need this for error messages and hints as well -#}
 {% set idPrefix = params.idPrefix if params.idPrefix -%}
 
 <div {%- if params.id %} id="{{params.id}}"{% endif %} class="govuk-tabs {%- if params.classes %} {{ params.classes }}{% endif %}" {%- for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{attribute}}="{{value}}"{% endfor %} data-module="govuk-tabs">
diff --git a/govuk_frontend_jinja/templates/components/textarea/macro.html b/govuk_frontend_jinja/templates/components/textarea/macro.html
index 8d186d78..b0504a66 100644
--- a/govuk_frontend_jinja/templates/components/textarea/macro.html
+++ b/govuk_frontend_jinja/templates/components/textarea/macro.html
@@ -4,7 +4,7 @@
 {% from "govuk_frontend_jinja/components/label/macro.html" import govukLabel %}
 
 {#- a record of other elements that we need to associate with the input using
-   aria-describedby – for example hints or error messages -#}
+  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 and params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
   {{ govukLabel({
@@ -40,6 +40,7 @@
 {% endif %}
   <textarea class="govuk-textarea {{- ' govuk-textarea--error' if params.errorMessage else '' }} {{- ' ' + params.classes if params.classes else ''}}" id="{{ params.id }}" name="{{ params.name }}" rows="{%if params.rows %} {{- params.rows -}} {% else %}5{%endif %}"
   {%- if (params.spellcheck == false) or (params.spellcheck == true) %} spellcheck="{{ params.spellcheck | lower }}"{% endif %}
+  {%- if params.disabled %} disabled{% endif %}
   {%- if describedBy %} aria-describedby="{{ describedBy }}"{% endif %}
   {%- if params.autocomplete %} autocomplete="{{ params.autocomplete}}"{% endif %}
   {%- for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{attribute}}="{{value}}"{% endfor %}>{{ params.value }}</textarea>
diff --git a/govuk_frontend_jinja/templates/components/warning-text/macro.html b/govuk_frontend_jinja/templates/components/warning-text/macro.html
index 0973bd92..f1169134 100644
--- a/govuk_frontend_jinja/templates/components/warning-text/macro.html
+++ b/govuk_frontend_jinja/templates/components/warning-text/macro.html
@@ -4,7 +4,7 @@
   >
   <span class="govuk-warning-text__icon" aria-hidden="true">!</span>
   <strong class="govuk-warning-text__text">
-    <span class="govuk-warning-text__assistive">{{ params.iconFallbackText }}</span>
+    <span class="govuk-warning-text__assistive">{{ params.iconFallbackText | default("Warning") }}</span>
     {{ params.html | safe if params.html else params.text }}
   </strong>
 </div>
diff --git a/setup.cfg b/setup.cfg
index 2673e8be..4026620c 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -5,7 +5,7 @@ license_files = LICENSE
 
 [flake8]
 exclude=venv
-ignore=E203,H301,H306,W503
+ignore=E203,W503
 max-complexity=10
 max-line-length=120
 
diff --git a/setup.py b/setup.py
index d7c8ce63..6c5887f2 100644
--- a/setup.py
+++ b/setup.py
@@ -13,7 +13,7 @@
 
 setuptools.setup(
     name="govuk-frontend-jinja",
-    version="2.5.0",
+    version="2.6.0",
     author="Matt Shaw",
     author_email="matthew.shaw@landregistry.gov.uk",
     description="GOV.UK Frontend Jinja Macros",


Test patch:
diff --git a/requirements-test-3.10.txt b/requirements-test-3.10.txt
index 36c79d3b..2e0b444d 100644
--- a/requirements-test-3.10.txt
+++ b/requirements-test-3.10.txt
@@ -8,7 +8,7 @@ click==8.1.3
     # via flask
 flake8==6.0.0
     # via -r requirements-test.in
-flask==2.2.2
+flask==2.2.3
     # via -r requirements-test.in
 itsdangerous==2.1.2
     # via flask
@@ -24,5 +24,5 @@ pycodestyle==2.10.0
     # via flake8
 pyflakes==3.0.1
     # via flake8
-werkzeug==2.2.2
+werkzeug==2.2.3
     # via flask
diff --git a/requirements-test-3.11.txt b/requirements-test-3.11.txt
index 6eea0e89..656105c1 100644
--- a/requirements-test-3.11.txt
+++ b/requirements-test-3.11.txt
@@ -8,7 +8,7 @@ click==8.1.3
     # via flask
 flake8==6.0.0
     # via -r requirements-test.in
-flask==2.2.2
+flask==2.2.3
     # via -r requirements-test.in
 itsdangerous==2.1.2
     # via flask
@@ -24,5 +24,5 @@ pycodestyle==2.10.0
     # via flake8
 pyflakes==3.0.1
     # via flake8
-werkzeug==2.2.2
+werkzeug==2.2.3
     # via flask
diff --git a/requirements-test-3.7.txt b/requirements-test-3.7.txt
index 0c93eb34..7d4f2f73 100644
--- a/requirements-test-3.7.txt
+++ b/requirements-test-3.7.txt
@@ -8,7 +8,7 @@ click==8.1.3
     # via flask
 flake8==5.0.4
     # via -r requirements-test.in
-flask==2.2.2
+flask==2.2.3
     # via -r requirements-test.in
 importlib-metadata==4.2.0
     # via
@@ -29,9 +29,9 @@ pycodestyle==2.9.1
     # via flake8
 pyflakes==2.5.0
     # via flake8
-typing-extensions==4.4.0
+typing-extensions==4.5.0
     # via importlib-metadata
-werkzeug==2.2.2
+werkzeug==2.2.3
     # via flask
-zipp==3.13.0
+zipp==3.15.0
     # via importlib-metadata
diff --git a/requirements-test-3.8.txt b/requirements-test-3.8.txt
index bad3da6a..93a38304 100644
--- a/requirements-test-3.8.txt
+++ b/requirements-test-3.8.txt
@@ -8,9 +8,9 @@ click==8.1.3
     # via flask
 flake8==6.0.0
     # via -r requirements-test.in
-flask==2.2.2
+flask==2.2.3
     # via -r requirements-test.in
-importlib-metadata==6.0.0
+importlib-metadata==6.6.0
     # via flask
 itsdangerous==2.1.2
     # via flask
@@ -26,7 +26,7 @@ pycodestyle==2.10.0
     # via flake8
 pyflakes==3.0.1
     # via flake8
-werkzeug==2.2.2
+werkzeug==2.2.3
     # via flask
-zipp==3.13.0
+zipp==3.15.0
     # via importlib-metadata
diff --git a/requirements-test-3.9.txt b/requirements-test-3.9.txt
index 377b806e..e3308d34 100644
--- a/requirements-test-3.9.txt
+++ b/requirements-test-3.9.txt
@@ -8,9 +8,9 @@ click==8.1.3
     # via flask
 flake8==6.0.0
     # via -r requirements-test.in
-flask==2.2.2
+flask==2.2.3
     # via -r requirements-test.in
-importlib-metadata==6.0.0
+importlib-metadata==6.6.0
     # via flask
 itsdangerous==2.1.2
     # via flask
@@ -26,7 +26,7 @@ pycodestyle==2.10.0
     # via flake8
 pyflakes==3.0.1
     # via flake8
-werkzeug==2.2.2
+werkzeug==2.2.3
     # via flask
-zipp==3.13.0
+zipp==3.15.0
     # via importlib-metadata
diff --git a/tests/utils/test-entrypoint.sh b/tests/utils/test-entrypoint.sh
index fcef80f7..459e7344 100755
--- a/tests/utils/test-entrypoint.sh
+++ b/tests/utils/test-entrypoint.sh
@@ -5,4 +5,4 @@ set -e
 flake8 .
 (cd tests/utils && nohup python -m flask run --port 3000 &)
 wait-for-it localhost:3000
-./govuk-frontend-diff http://localhost:3000 --govuk-frontend-version=v4.5.0
+./govuk-frontend-diff http://localhost:3000 --govuk-frontend-version=v4.6.0