govukAttributes
macro doesn't output values that use Nunjucks' safe
filter
#4937
Labels
Milestone
govukAttributes
macro doesn't output values that use Nunjucks' safe
filter
#4937
Raised and investigated via support.
Description of the issue
The
govukAttributes
macro, when provided a map of key-value pairs, will fail to output values that have previously passed through the Nunjuckssafe
filter.This appears to be because the output of the
safe
filter is (if notnull
) actually an object, which thegovukAttributes
macro is interpreting to be one of our first-party attribute configuration objects.Steps to reproduce the issue
Use this code in a project using GOV.UK Frontend's Nunjucks macros. The use of Back Link component here is illustrative, this issue is present in all components that use
govukAttributes
.Each of the
safe
filtered values as they're exposed by thedump
filter. Thesafe
filter appears to convert anything passed to it into a string.Actual vs expected behaviour
(HTML output has been reformatted for easier reading.)
Actual output
Expected output
Environment (where applicable)
The text was updated successfully, but these errors were encountered: