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.

Comments

tonifisler created an issue. See original summary.

ozin’s picture

Hi,

Did you enable the "Summary input" checkbox for your field on the field settings form?

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

xem8vfdh’s picture

I'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

iojonep’s picture

+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.

ozin’s picture

Did you have any js errors in console?

ozin’s picture

Indeed 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.

ozin’s picture

Priority: Normal » Major
Status: Needs work » Needs review
StatusFileSize
new993 bytes

There is a patch which fix text.js to find correct label.

ozin’s picture

Title: "Edit Summary" link not showing if Description is set » "Edit Summary" link not showing if "Help Text" is set
jacktonkin’s picture

Version: 8.1.x-dev » 8.3.x-dev
Assigned: Unassigned » jacktonkin
Status: Needs review » Needs work
+++ b/core/modules/text/text.js
@@ -22,7 +22,7 @@
+        var $full = $widget.find('.js-text-full').closest('.text-format-wrapper .js-form-item');

I 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.

jacktonkin’s picture

Status: Needs work » Needs review
StatusFileSize
new3.18 KB
new3.75 KB

The 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.

The last submitted patch, 11: edit-summary-not-showing-11411975-11-test-only.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 11: edit-summary-not-showing-11411975-11.patch, failed testing.

jacktonkin’s picture

Turns out git add -N doesn't work for making patches.

jacktonkin’s picture

Assigned: jacktonkin » Unassigned
Status: Needs work » Needs review

The last submitted patch, 14: edit-summary-not-showing-11411975-14-test-only.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 14: edit-summary-not-showing-11411975-14.patch, failed testing.

jacktonkin’s picture

Status: Needs work » Needs review
StatusFileSize
new3.09 KB
new3.66 KB

The last patched left in a createScreenshot() call.

The last submitted patch, 18: edit-summary-not-showing-11411975-18-test-only.patch, failed testing.

jacktonkin’s picture

dawehner’s picture

I 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.

Kudos for writing those tests! Great to see people picking it up.

  1. +++ b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php
    @@ -0,0 +1,86 @@
    +    $this->drupalGet('/node/add/page');
    

    Nitpick: We usually don't prepend this path with a slash.

  2. +++ b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php
    @@ -0,0 +1,86 @@
    +    $this->summaryToggleHelper();
    

    I'm wondering whether you can think of a better name for this function. Maybe assertSummaryToggle?

jacktonkin’s picture

  1. Fixed, thanks.
  2. I can't think of a better name than assertSummaryToggle, so going with your suggestion!

The last submitted patch, 22: edit-summary-not-showing-11411975-22-test-only.patch, failed testing.

james.williams’s picture

This fixed the issue for me too, thanks!

michielnugter’s picture

The 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.

arvidkuipers’s picture

This 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

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ron collins’s picture

#22 fixed it for me on 8.3.

tedbow’s picture

StatusFileSize
new1.33 KB
new4.28 KB

Just re-rolled, plus
Update text.es6.js file
Fix array syntax in test file.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

MaskOta’s picture

Status: Needs review » Reviewed & tested by the community

The patch still applies on 8.5.x and it fixes the issue.

Thanks guys!

xjm’s picture

Status: Reviewed & tested by the community » Needs work

Thanks for working on this!

+++ b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php
@@ -0,0 +1,86 @@
+    // Repeat test with non-empty field description.
+    // @see https://www.drupal.org/node/2626716

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. :)

MaskOta’s picture

Status: Needs work » Needs review
StatusFileSize
new4.22 KB
new739 bytes

Removed the comment as per #32

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dpagini’s picture

Status: Needs review » Reviewed & tested by the community

I 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. =)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 33: 2626716-33.patch, failed testing. View results

Mixologic’s picture

Status: Needs work » Reviewed & tested by the community

Temporary testbot hiccup.

joelpittet’s picture

It 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.

alexpott credited Truptti.

alexpott credited droplet.

alexpott credited kryp71c.

alexpott’s picture

alexpott’s picture

Creditting @dawehner for the review.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 4b9a1216b5 to 8.6.x and d653a9ce37 to 8.5.x. Thanks!

  • alexpott committed 4b9a121 on 8.6.x
    Issue #2626716 by jacktonkin, MaskOta, tedbow, michielnugter, ozin,...

  • alexpott committed d653a9c on 8.5.x
    Issue #2626716 by jacktonkin, MaskOta, tedbow, michielnugter, ozin,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.