-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Describe the bug
GovCheckboxInput (at least, probably also GovCheckboxesInput?) is rendering None hints for me. This seems tied back to https://github.com/LandRegistry/govuk-frontend-wtf/blob/main/govuk_frontend_wtf/gov_form_base.py#L109, where we always include a "hint" object based on field.description. If field.description is None, we pass through "hint": {"text": None}. The macro for GovCheckboxes then looks for if params.hint, which will evaluate as truthy.
There are two places to fix this, I guess:
- govuk-frontend-jinja: check for
if params.hint and (params.hint.text or params.hint.html), or similar. - govuk-frontend-wtf: in map_gov_params, only set
hintiffield.descriptionis truth-y.
To Reproduce
Steps to reproduce the behavior:
- Create a wtform with a BooleanField using GovCheckboxInput. Do not pass a description to the field.
- Render it on the page.
- Check HTML and see that we still render the hint, but it's empty
- Change the form to pass
description=None; reload the page and you'll seeNoneis shown as text in the hint.
Expected behavior
An empty hint text ("" or None) does not render on the page.
Screenshots

Metadata
Metadata
Assignees
Labels
No labels