Skip to content

[Twig][Live] null attribute values render without value (ie autofocus) #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2022

Conversation

kbond
Copy link
Member

@kbond kbond commented Feb 2, 2022

Q A
Bug fix? yes
New feature? no
Tickets n/a
License MIT

Ref: #220 (comment)

A null attribute value renders without the value:

{# templates/components/my_component.html.twig #}
<input{{ attributes}}/>

{# render component #}
{{ component('my_component', { type: 'text', value: '', autofocus: null }) }}

{# renders as: #}
<input type="text" value="" autofocus/>

TODO:

@kbond kbond changed the title [Twig][Live] ensure null values can be used as component attributes [Twig][Live] null attribute values render without value (ie autofocus) Feb 3, 2022
@kbond
Copy link
Member Author

kbond commented Feb 3, 2022

Pending a final review, I believe this ready to go.

I found a bug in the CI (build-packages.php wasn't called correctly). I fixed in this PR but can move to another if desired. Fixed in #267.

@kbond kbond requested a review from weaverryan February 3, 2022 16:49
@weaverryan
Copy link
Member

Thanks Kevin!

@weaverryan weaverryan merged commit 9f50cbb into symfony:2.x Feb 4, 2022
@kbond kbond deleted the null-attributes branch February 4, 2022 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants