-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[TwigBridge] Provide a default non-empty label on empty options to validate HTML5 #44464
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
Conversation
Hey! I think @VincentLanglet has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
Don't really feel like I broke any test, here. ^^ |
should this |
That's an excellent question, @stof. My understanding so far is that the placeholder should provide a value, hence removing the need for the label attribute. (if I read everything correctly) |
src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
Outdated
Show resolved
Hide resolved
Not sure about this change, but that would be for 6.2. |
Haha I totally forgot about that PR. I just had to re-read it. XD Was just an ultra-low-priority suggestion. I can delete this and do a new one on 6.2, if not already done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please rebase for 6.2?
Also, why not go with : '--'
on the ternary op inside the tag? That'd make more sense to me.
Done! :)
My brain is in slow mode today (rhinopharyngitis), not sure I understand what you mean ^^ |
src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
Outdated
Show resolved
Hide resolved
Thank you @DocFX. |
I merged to fast. This breaks tests so I reverted in 88191f5 |
Oh yeah, sorry, the first time I opened it the tests were failing for external reasons. |
As described on https://rocketvalidator.com/html-validation/element-option-without-attribute-label-must-not-be-empty, so far this template generates empty options with no value, no content, and no label. This is not a break, but a simple "should".
Not sure how we should recommend handling this, users have the possibility to handle this themselves (https://symfony.com/doc/current/reference/forms/types/choice.html#placeholder), but if they don't we leave a non-stadanrd-compliant output.
The tailwind template is also affected from this, as it extends this one.
I proposed a double-dash default value:
I locally fix this by overriding the default templates, but I thought the default ones could get a fix.
Also, to make it quick, I proposed to change this starting 5.4. Maybe we can push this back to 4.4?