Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
- Install standard
- Create an article node
- Use quick edit on node
- Can't edit the body field
Proposed resolution
git co ac15de3
is the last working commit. The regression is introduced by #2214241: Field default markup - removing the divitis - unfortunately a clean revert is not possible and also the issue had over 300 comments so I don't think reverting it would be a good idea anyway.
Remaining tasks
- Write patch
- Add tests
- Commit
User interface changes
N/a
API changes
N/a
Data model changes
N/a
Next step
Manually test the problem is fixed.
Comment | File | Size | Author |
---|---|---|---|
#22 | 2559877.11.patch | 784 bytes | alexpott |
#20 | 2559877-13.patch | 1.38 KB | chx |
#20 | interdiff.txt | 736 bytes | chx |
Comments
Comment #2
Wim Leers:(
This happened despite it having been manually tested in that issue.
I hope somebody with deep knowledge of that issue will take this on.
Comment #3
davidhernandezWas just testing. Noticed that the functionality still works on the home page view which renders the full node as a teaser. I think the quick edit has some JS that might be relying on the structure of divs. Maybe it just needs a tweak.
Comment #4
davidhernandezI confirmed it is the body field. Other fields on the node work. Here is the markup. What am I missing?
Comment #5
dawehnerSo you would not release Drupal with that bug?
Comment #6
davidhernandezWell, feature-wise quickedit is somewhat useless if you can't edit the body text.
Comment #7
davidhernandezConfirming that it is also broken in Stark.
Comment #8
davidhernandezGot it. Hiding the label breaks it. Quick edit, rightly or wrongly, is relying on the structure of the
field__item
wrapper div inside the main field div. With no label there is no need for that extra div so it was removed. If you look at the field template you can see the ifs.Comment #9
davidhernandezSo I thought perhaps we have to have the field__item div inside the main one for this to work, but maybe not. I hid the field for an integer field and the quickedit still works. So it looks like it is smart enough to know if there is no markup inside the field, but not when it is text with summary of has the paragraph tags or something.
Comment #10
alexpottIt's a problem the editor's quickedit implementation. The plain text editor provided by quickedit already has similar code to what this patch adds.
Comment #11
nod_Comment #12
alexpottTidying up...
Comment #13
davidhernandezAh ok the generic editor. So previously it only looks to see if field__item exist and grabs the first element. This makes it check to see if it exists and if not use what might be considered the parent.
Why the double equals?
this.$el
Shouldn't this also have
eq()
? In both cases you are grabbing whatever is inside.Comment #14
davidhernandezOk, #12 removed those equals.
Comment #15
swentel CreditAttribution: swentel commentedHad something alike - but also changed the class to use .quickedit-field instead of field__item - I think that will be more robust.
Then themers can eventually even completely remove the field__item class as .quickedit-field is added by quickedit.js
- edit - crosspost all the way :)
Comment #16
davidhernandezI approve of moving it to a quickedit class. That would have to maybe be refactored since you are now moving it to the parent div. It might try to edit that div inside as well.
Comment #17
davidhernandezThis looks like it would try to edit the label since it comes before the field__item div.
Comment #18
dawehnerI seem to be drunken ... everything is double ;)
this.$textElement = this.$textElement
Comment #19
davidhernandez@dawwehner, yes alex fixed that in 12. I think swentel just copied what was in 10.
Comment #20
chx CreditAttribution: chx commentedComment #21
davidhernandezYeah, I checked. This grabs the label along with it.
edit: With the change to the quickedit class. I didn't grab that line in dreditor.
Comment #22
alexpottI think we should just fix the critical bug and discuss how to make this more reliable in another issue. re-uploading the patch in #12. Unfortunately I don't think we have the infrastructure to do automated tests for this.
Comment #23
dawehnerI agree that's fix the critical issue quick and then edit the code for further improvements in #2559955: Ensure that Quick Edit relies less on the structure of the HTML
Did some manual testing ...
Comment #24
davidhernandezThis does not work with multi-value fields. I assume that was actually broken by the field markup changes as well. It looks to be broken in head.
This won't fix it, because there are multiple divs inside el that have .field__item. They are not differentiated.
If this wasn't considered critical before, it definitely is now because the current problem destroys data. If you try to edit a multivalue field it puts the value of the first one into all the other ones, and you won't know until you hit save.
Comment #25
davidhernandezHere is a gif. http://g.recordit.co/jWijCilb9s.gif
Comment #26
davidhernandezI checked the code from before the field markup issue was committed, this would still be a problem. Even with the field-items wrapper it doesn't bother to look for it and just grabs the first item. This may have been broken for a while then. Does anyone recollect the last time they know for certain it worked?
Comment #27
rakesh.gectcr+1
Comment #28
subhojit777I have been following this issue since this morning (IST). I just tested this with current codebase without applying patch and quickedit seems to be working with body field. i tested with single valued field.
http://www.gfycat.com/PlainImmaterialEidolonhelvum
EDIT
At morning it was not working, with patch it was working.
Comment #29
subhojit777Also working with multivalued body field http://www.gfycat.com/NervousWeepyGreatwhiteshark Tested with new content type.
P.S. gif quality is a bit poor
Comment #30
davidhernandezWhat generates that popup? When I edit a field a don't get the editor as a popup window, it is set in the page.
Comment #31
davidhernandezI checked with a fresh install with and without the patch. That popup happens with a "Text (formatted, long, with summary)" field, which the body field is, but it doesnt happen for me on the body field. It only happens on a field I add. Also, I don't think we are suppose to get that popup anyway. I think the edit in page with the wysiwyg toolbar in the hovered box is the desired result.
Looking at the markup being produced something isn't right in the logic for multiples and with or without label. Without a label the inner div ends up being produced but mocks all the properties of the parent, which doesn't seem right. I'm not sure though why the body field behaves differently.
Comment #32
RainbowArrayDavid:
I can't duplicate the behavior you showed in your gif. I tried create multiple values, both with Formatted Long Text With Summary and Plain Text. I also tried with the label on and with the label off. Quick edit worked fine with all of those.
I tested the patches in #20 and #22. Both seemed to work fine.
Could you please list the exact you used to create the fields that exhibited this problem? The field settings as well as the field display settings?
If there is an existing problem from before this patch that deals with some type of multiple-value fields, then let's handle that in a separate issue.
Comment #33
davidhernandezSo it was happening consistently for me with the body field of both of the default content types, Article and Basic, even after re-installing a couple times. I just did a git pull and re-installed again, and I can't reproduce it. I was only a couple of commits behind, and see nothing that would have had an affect, so maybe I'm taking crazy pills.
I'm intentionally trying to break the patch in #22, but nothing directly related to this so far. I did discover that if you turn off ckeditor quickedit seems broken.
...every once in a while it just does something weird. Something here is fragile.
Comment #34
webchickCommitted and pushed to 8.0.x, thanks! Although it's frustrating that this keeps happening due to unrelated patches. :( Something to include in our pre-RC checklist for sure, since we can't automated test for it.