alphagov / govuk-frontend

GOV.UK Frontend contains the code you need to start building a user interface for government platforms and services.
https://frontend.design-system.service.gov.uk/
MIT License
1.18k stars 325 forks source link

Restore behaviour of Back Link component for falsy `text` and `href` options #5189

Closed romaricpascal closed 3 months ago

romaricpascal commented 3 months ago

What

Make text and href correctly render default values when a falsy value is passed to the component, and add some tests checking this for undefined/null and different kinds of falsy values 0,'', false.

Why

The use of the default filter means only undefined values are replaced by the default value provided to the filter. This means a '' string as text would make the button render with no content, causing both visual and accessibility issues.

Who needs to work on this

Developers

Who needs to review this

Developers

Done when