If you create a Long text with summary field and add a description to it, the "Edit Summary" link isn't appended to the correct place.
It is added next to the Summary label, but should appear next to "Body". The Summary field being hidden, the link is completely missing.
`core/modules/text/text.js`, line 25 is looking for the class .js-text-full element's parent, but it is also added to the description field, in core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextfieldWidget.php, at line 82.
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | interdiff-29-33.txt | 739 bytes | MaskOta |
| #33 | 2626716-33.patch | 4.22 KB | MaskOta |
| #29 | 2626716-29.patch | 4.28 KB | tedbow |
| #29 | interdiff-26-29.txt | 1.33 KB | tedbow |
| #25 | edit-summary-not-showing-11411975-24.patch | 3.72 KB | michielnugter |
Comments
Comment #2
ozinHi,
Did you enable the "Summary input" checkbox for your field on the field settings form?
Comment #4
xem8vfdh commentedI'm having the opposite problem. The Page body field is "Long text with summary", and despite un-checking the "Summary input" box, saving, and flushing caches, the summary field still shows when editing a page.
Reported mine here: https://www.drupal.org/node/2757935
Comment #5
iojonep commented+1 Same issue.
When entering text into the "Help Text" field of a body field with type Text (formatted, long, with summary) in any content type, the "Edit Summary" link disappears on edit pages.
I tried with "Summary input" checked, making the field required and not required. Verified on all of my content types. Rebuilt cache, still not working.
Looks like a JavaScript is not properly displaying the "Edit Summary" link as described in the original issue.
Comment #6
ozinDid you have any js errors in console?
Comment #7
ozinIndeed this bug exist and it caused by the description field CSS classes "js-text-full text-full" which are used in the text.js. I will provide patch to fix js, but will need to figure out where those classes were added, only Formatted fields have this.
Comment #8
ozinThere is a patch which fix text.js to find correct label.
Comment #9
ozinComment #10
jacktonkin commentedI think this can be simper if we just look for children in
$widget. Also, assigning to myself to have a go at writing a test.Comment #11
jacktonkin commentedThe full value sub-field is a direct descendant of the wrapper so I've selected it with:
$widget.children('.js-form-type-textarea');Attached are test-only and full patches that apply cleanly to 8.1.x, 8.2.x and 8.3.x. No interdiff because the fix is only one line.
Comment #14
jacktonkin commentedTurns out git add -N doesn't work for making patches.
Comment #15
jacktonkin commentedComment #18
jacktonkin commentedThe last patched left in a
createScreenshot()call.Comment #20
jacktonkin commentedComment #21
dawehnerKudos for writing those tests! Great to see people picking it up.
Nitpick: We usually don't prepend this path with a slash.
I'm wondering whether you can think of a better name for this function. Maybe assertSummaryToggle?
Comment #22
jacktonkin commentedComment #24
james.williamsThis fixed the issue for me too, thanks!
Comment #25
michielnugter commentedThe fix works.
I updated the test to avoid the assertTrue() calls, the Trait these functions are in is deprecated and on track to be removed for 9.x.
One doubt I have: Does it need a test for 2 fields with summaries on 1 page. The behavior should work for both but it's not tested right now. Another test I just made (#2821320) actually exposed a potential error with 2 elements.
Comment #26
arvidkuipers commentedThis post helped A LOT!
I was wondering why I did not see the 'Edit Summary' link on the long-text-with-summary field.
Aha! So it was the help text - Thanks a lot.
Have a great day
Comment #28
ron collins commented#22 fixed it for me on 8.3.
Comment #29
tedbowJust re-rolled, plus
Update text.es6.js file
Fix array syntax in test file.
Comment #31
MaskOta commentedThe patch still applies on 8.5.x and it fixes the issue.
Thanks guys!
Comment #32
xjmThanks for working on this!
We shouldn't link issue the issue node in the codebase; it's discoverable with git blame. If there's information on this node that someone actually should have when reading this code, then we should put that information in the comment directly. And if they don't actually need the information, then we shouldn't send them on a wild goose chase to the sprawling thread of an issue. :)
Comment #33
MaskOta commentedRemoved the comment as per #32
Comment #35
dpagini commentedI think this was RTBC status, and just a comment was deleted, so it seems it should go back to RTBC. In addition, I ran into this exact same issue and am using this patch to fix the problem... so 2x RTBC. =)
Comment #37
MixologicTemporary testbot hiccup.
Comment #38
joelpittetIt may be worth crediting some of the people on #2624496: "Edit summary" button broken if text area with a summary has description (not me, though) because they worked hard on the same problem and had tests as well and was opened a few days earlier.
Comment #49
alexpottCrediting those who worked on #2624496: "Edit summary" button broken if text area with a summary has description
Comment #50
alexpottCreditting @dawehner for the review.
Comment #51
alexpottCommitted and pushed 4b9a1216b5 to 8.6.x and d653a9ce37 to 8.5.x. Thanks!