Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
forms system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Apr 2016 at 13:26 UTC
Updated:
19 Mar 2025 at 09:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
tomzoocha commentedI've created a patch for this issue.
I added the ".addClass" function to the "before" block, as it is in the "after" block.
Comment #3
star-szrThanks. There is a chance this would be something we can fix in Stable if I understand correctly but needs more thought as to whether it will break things. We definitely want to fix the core form element template though so needs work for that.
Comment #15
nikhil_110 commentedAttached patch against Drupal 9.5.x
Comment #16
ashutosh ahirwal commentedProviding Patch for D9.5.
Comment #17
markconroy commentedComment #18
markconroy commentedThis looks like it is a bug, however we'll need to fix it in more than just Stable9. I think we need to fix it in:
It's already fixed in Olivero and Claro (Claro issue: #3081563: When a form field's description is set to display before the input, it doesn't get the description classes)
The patch in #15 is the preferred approach. #16 has a space between the
divand theexpression(<div {{instead of<div{{.Comment #19
rishabh vishwakarma commentedAddressed the points mentioned in #18.
Comment #20
rishabh vishwakarma commentedModified the approcah IGNORE #19
Comment #23
rishabh vishwakarma commentedRemoved the changes from the theme: demo_umami > classy as it is causing test failures.
Comment #24
markconroy commented@Rishabh Vishwakarma Thanks for working on this.
I wonder could you move the form-element.html.twig file from umami > classy directory to umami > templates > form directory (I think you'll need to create that directory).
I'm not sure if that will also break the tests, but it's worth trying. If that does break the tests, then we have another (perhaps bigger) issue for Umami if we can add new generic templates that have the same name as templates in the umami > classy directory.
Also, I think it's worth creating this patch against 10.1.x rather than 9.5.x
Comment #25
smustgrave commentedComment #26
Aadhar_Gupta commentedCreated the patch for drupal 10.1.x and also addressed the issue as stated in #24
Comment #27
markconroy commentedWe need to add the description classes to this item. Once that's done, I think this is ready for RTBC.
Comment #28
Aadhar_Gupta commentedApplied changes according to #27
Comment #29
smustgrave commentedLGTM
Comment #31
markconroy commentedSetting to 'needs review' to get the bots to test again.
Comment #32
smustgrave commentedThink it was a random failure
Comment #33
star-szrThanks for the work on this! Why do we change the indentation like this, in multiple files? Earlier versions of the patch don't have this change. Please maintain the same indentation level.
Comment #34
mrinalini9 commentedUpdated patch #28 by addressing #33, please review it.
Thanks!
Comment #35
smustgrave commentedindentation seems fixed
Comment #36
lauriiiI think we should just move the template out from the Classy directory and then fix it. I don't think we want to have duplicate templates there.
Seems fine as a bug fix for Stable 👍
Comment #37
markconroy commentedHere's a patch that removes (renames) template from templates/classy/form to templates/form, and fixes the issue there so there's no duplicate template.
Comment #39
markconroy commentedThis has failed because the template was removed from the classy directory but I can't find the test to remove the template name from the list of classy templates - https://git.drupalcode.org/project/drupal/-/tree/10.1.x/core/tests/Drupa... (no test in here for ConfirmClassyCopiesTest)
Comment #40
lauriiiIt exists in 9.5.x: https://git.drupalcode.org/project/drupal/-/blob/9.5.x/core/tests/Drupal.... I sent the patch to be re-tested in 10.1.x.
Comment #41
markconroy commentedOh great, thanks @lauriii
Comment #42
arunkumarkReviewed the patch manually and the fixes are working as expected. Attached screenshot for reference.
Before patch applied:
After Patch applied:

The patch can be move for RTBC.
Comment #43
markconroy commentedComment #45
markconroy commentedNot sure why the bots reset this, moving back to RTBC
Comment #47
rpayanmI am told that they've had a random test failure explosion the past few days.
Comment #49
smustgrave commentedRandom
Comment #50
markconroy commentedI think it's because of the 9.5 tests failing. Hopefully we'll get this committed soon and not need to keep resetting it.
9.5.x: PHP 8.1 & MySQL 5.7 30,310 pass, 1 fail 🤖 re-tests every 2 daysComment #51
larowlanThe patch is failing in 9.5 with what looks like a relevant failure from this issue.
If this should be applied to 9.5, we need a 9.5 patch too.
Thanks folks
Comment #52
Vidushi Mehta commented#37 was applying on 9.5.x after the latest pull, adding a patch for 9.5.x for the same.
Comment #53
smustgrave commentedUmami has that template already. Under templates/classy.
Comment #54
markconroy commented@larowlan and @lauriii I'm not fully sure how to fix this for 9.5.x
form-element.html.twiginside umami/templates/classy then we have a duplicate template (like we have in #52 and #23 (we're starting to go around in circles).form-element.html.twigfrom theConfigClassyCopiesTesttest. I have removed that in this test, but now it will mean that all other themes in 9.5 that have a classy folder will fail, since they will have aform-element.html.twigfile which the test says they should not have.My proposal: commit my patch from #37 so we have D10 fixed and either figure out how to solve it for D9, or don't worry about it as D9 is EOL in November.
There's no interdiff with this patch, as it's purely for 9.5 instead of D10 which #37 solves.
Comment #55
larowlanThanks @markconroy - I'll defer to @lauriii in his FEFM capacity w.r.t what his preference would be
Comment #56
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #57
lauriiiThis seems like a good fix for Stable and Classy, but since we are adding additional classes for some use cases, it may have an impact on existing themes. Because of the changes to Classy and Stable, I think we may want to err on the side of caution and refrain from backporting to 10.0.x and 9.5.x.
Comment #59
saurav-drupal-dev commentedunable to reproduce due to missing steps. tried patch applied successfully not tested yet.

Comment #60
saurav-drupal-dev commentedComment #63
liam morlandEdit: The steps to reproduce are clear to me.
Comment #64
smustgrave commentedShouldn't remove a tag without saying why.
But since the entire issue summary needs updating (steps to reproduce included) I've added that tag.
Twig template change will require a CR as well.
Thanks.
Comment #65
liam morlandComment #66
arunkumarkCreated the Draft Change record for the issue. Feel free to edit the description. The screenshot needs to be updated.
Change Record: https://www.drupal.org/node/3482370
Comment #67
liam morlandI have updated the change record.
Comment #68
smustgrave commentedI'd recommend removing the part about this applies to the core templates and themes. Purpose of the CR is to announce a change that other themes may won't to adapt if they have overridden or included in their base theme.
Would also recommend a simple before/after snippet of the change and maybe mention the classes that will now be applied.
Comment #69
liam morlandChange record updated.
Comment #70
smustgrave commentedCleaning up issue and updated CR.
Comment #75
nod_Committed 05b4206 and pushed to 11.x. Thanks!