You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But this has prevented us from appending or merging new formGroup attributes to existing defaults in #4566 and in Create Password spikes #4512 (comment)
Context
This feature request comes from a by-design Nunjucks snag
Supporting params.attributes as strings may simplify work on proposed attribute macros and we may want params.classes to work with string or object types too.
The text was updated successfully, but these errors were encountered:
Related component
All components currently render Nunjucks
attributes
by looping object name/value pairs:This is unlike
params.classes
where string values are uses instead:But this has prevented us from appending or merging new
formGroup
attributes to existing defaults in #4566 and in Create Password spikes #4512 (comment)Context
This feature request comes from a by-design Nunjucks snag
Like in Jinja, object modification is not possible mozilla/nunjucks#307
Whilst looping object name/value pairs give us more flexibility (filtering, sorting), this means:
This has been mentioned in the past (see #995, #1529, and mozilla/nunjucks#1455 etc)
The suggestion to support string values came from @36degrees in #4566 (comment)
Alternatives
Alternatively, we've tried a clever hack to push to
Object.entries()
arrays in Nunjucks for loopsBut it's quite obscure and arrays lack named property access used by
govukI18nAttributes()
etcAttributes as plain object
Attributes as
Object.entries()
arrayAdditional information (if applicable)
Supporting
params.attributes
as strings may simplify work on proposed attribute macros and we may wantparams.classes
to work with string or object types too.The text was updated successfully, but these errors were encountered: