
Set an error on a "container" or a "details" element (the root of a widget, for example), and it won't be shown. Meanwhile, fieldsets work fine.
If the element has children (and it usually does), the children will (incorrectly, #2509268: Inline errors repeated on child elements in module uninstall form) show the errors, but as soon as we fix that, the error messages won't actually be seen. Swallowing errors sounds big enough to be critical, but feel free to knock it down to major.
Beta phase evaluation
Issue category | Bug because certain errors get suppressed now |
---|---|
Issue priority | Major because user can not see the error. |
Disruption | Zero disruption. |
Comment | File | Size | Author |
---|---|---|---|
#25 | details-after.png | 273.94 KB | bojanz |
#25 | details-before.png | 259.59 KB | bojanz |
#18 | inline_errors_not_shown-2512306-18.patch | 5.32 KB | borisson_ |
#18 | interdiff.txt | 766 bytes | borisson_ |
#16 | interdiff-2512306-12-16.txt | 3.25 KB | jeroent |
Comments
Comment #1
tim.plunkettI don't even know if this is valid HTML, but I borrowed the preprocess bit from template_preprocess_fieldset()
We're just swallowing the visual representation, the form will still fail validation correctly, so marking this major.
Not sure how to handle container
Comment #2
bojanz CreditAttribution: bojanz at Centarro commentedWe also need to modify the classy template, that's the one themes end up using. In the attached patch.
So, the container preprocess and template file can easily get the same treatment, but what makes container different is the fact that it's a generic theme/render element, not a form element. Is it weird for it to have errors in that case? Either it isn't, and we make the change, or it is, and we find a way to forbid setting errors on it, while communicating to people writing widgets and forms that they need to use a details element instead.
Comment #3
fabianx CreditAttribution: fabianx as a volunteer commented#2: Why not put the errors to #prefix in that case to have them shown before the container element itself?
Containers are double-tricky as they are applied as #theme_wrappers on other elements always, so probably not even template_preprocess_container might help much here, as the element is already themed.
The patch here looks good for details.
Unless we find a good way (someone will need to do some experiments), I would suggest to split container off to another issue.
Comment #4
bojanz CreditAttribution: bojanz at Centarro commentedOkay, opened #2560467: Inline Errors not shown for container elements for the contaienr element.
Comment #5
bojanz CreditAttribution: bojanz at Centarro commentedComment #6
googletorp CreditAttribution: googletorp commentedFor details this patch is good, let's get it in.
Comment #7
bojanz CreditAttribution: bojanz at Centarro commentedWe need to change the form-error-message class to form-item--error-message, to sync with #2501903: inline form errors classnames to follow namestandard.
Would also be great to figure out a test.
Comment #8
googletorp CreditAttribution: googletorp commentedThe actual class name fix, was pretty simple, so let's just do that right away so we don't forget later on.
Will see if I can come up with a test for this as well.
Comment #9
strykaizerAttached you'll find a test only and patch with test + code from #8
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedLooks great! I only found one nitpick:
s/True/TRUE
Comment #12
strykaizerThx for the review!
Comment #13
strykaizerComment #14
Anonymous (not verified) CreditAttribution: Anonymous commentedLooks good to me!
Comment #15
bojanz CreditAttribution: bojanz at Centarro commentedLooks like we're reusing an unrelated form? Why not add our own (+ route)? FormTestDetailsForm for example?
Comment #16
jeroentCreated separate form and page for this test.
Patch attached.
Comment #17
bojanz CreditAttribution: bojanz at Centarro commentedThank you, JeroenT and StryKaizer. You are making my day.
The #group no longer means anything, so we can remove it. And the #title can be "Details element".
Other than that, this looks ready for an RTBC.
Comment #18
borisson_Attached patch fixes #17.
Comment #19
bojanz CreditAttribution: bojanz at Centarro commentedWe're good to go. Thanks, everyone.
If in the mood for more related work, the next one is: #2027059: Improve the documentation of WidgetBase::errorElement() for mapping violation property paths to form elements.
Comment #20
alexpottIs the div necessary... putting on my morten hat? And then the if is not necessary either.
Also screenshots would be nice.
Comment #21
bojanz CreditAttribution: bojanz at Centarro commentedI added the div because fieldset.html.twig in the same folder has one:
Let's ask a themer.
Comment #22
mortendk CreditAttribution: mortendk as a volunteer commentedyes its correct that we have the same inside of fieldset.html.twig and in classy it have nice classes on it.
So it looks stupid with those div's for the sake ofthe divs - it was a part of the cleanup process on getting classy fixed.
we should probably kill those divs at some point as they have no meaing to core and only to classy, but i would suggest that its a followup in the ongoing divitis killing thats taken place, but thats for another issue (and we have one allready)
im pushing it back to rtbc
@alex can i get my hat back ;)
Comment #23
bojanz CreditAttribution: bojanz at Centarro commentedThank you, Morten.
Alex, I'll add a screenshot ASAP.
Comment #24
davidhernandezThe empty div is necessary because "errors" does not produce structured html content, at least not always, so you can edit up with just a string printed there without a paragraph tag or anything wrapping it.
Comment #25
bojanz CreditAttribution: bojanz at Centarro commentedI used the provided form.
As I said, the error repeated on all elements is the result of a different bug (#2509268: Inline errors repeated on child elements in module uninstall form), and will actually be gone at one point.
The expected behavior is for the error to be shown on top of the form.
Comment #26
alexpottThanks @bojanz - we need to get all of this cleanup somehow done before rc :(
Nice work everyone. Committed 553e77c and pushed to 8.0.x. Thanks!