Required summary element hidden when other text-with-summary fields do not require summary

Created on 4 June 2020, over 4 years ago
Updated 29 March 2023, over 1 year ago

Problem/Motivation

When you have 2 or more text with summary fields and 1 has required summary but the others do not. The required summary is hidden.
The summary form element for the first text field is concealed and requires an additional "Edit Summary" click to reveal the summary form element.

Steps to reproduce

On a content type:
1. Create a "text with summary" field with summary input and required summary.
2. Create a second "text with summary" field with summary input. Do not require summary.
3. Attempt to create a new node.

Proposed resolution

The form should expose the summary form element for the first text field, and there should be no "Hide Summary" link.

From original posting
If I comment out line 41 of "text.js" ($link.trigger('click');), the summary element is not concealed but the "Hide Summary" link remains.

Inserting a simple logging statement (like console.log($(this));) before line 13 (var $widget = $(this).closest('.js-text-format-wrapper');) indicates that this code is getting executed for both fields.

A required class is added to the summary element, at least in my configuration. A simple fix is therefore to filter out required text summaries.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Fixed

Version

9.5

Component
Text 

Last updated 17 days ago

Created by

🇺🇸United States natedouglas

Live updates comments and jobs are added and updated live.
  • JavaScript

    Affects the content, performance, or handling of Javascript.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇳China jungle Chongqing, China

    #30 faild to apply, because of #3181778: [w/c September 17th] Replace t() with $this->t() in all plugins

    interdiff-30-33.txt in #33 is empty. The following is supposed to be its content.

    $ diff 3145850-30.patch 3145850-33.patch
    2c2
    < index 1dcb00b96b..1986fa120f 100644
    ---
    > index 60b51650c8..3b1f541d7d 100644
    6c6
    <        '#title' => t('Summary'),
    ---
    >        '#title' => $this->t('Summary'),
    
    • #36 tested it manually,
    • the test-only patch in #25 is still valid,
    • #28 was addressed.

    Thanks!

  • First commit to issue fork.
  • @kunal_sahu opened merge request.
  • 🇮🇳India kunal_sahu Karnataka

    Hi I have created an MR . Please Merge. thanks

  • 🇺🇸United States smustgrave

    @kunal_sahu thanks for the interest but the patch #33 was already reviewed. So the MR is just reuploading the work that was already done. So removing credit for that unless there was something you were fixing.

    Thanks

  • 🇮🇳India gauravvvv Delhi, India

    Updated attributions

  • Status changed to Needs work over 1 year ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
    +++ b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php
    @@ -94,10 +94,50 @@ public function testTextSummaryBehavior() {
    +    $this->assertEquals(TRUE, $summary_field->isVisible(), 'Required summary is always shown.');
    

    No need for the message here, as @quietone pointed out above in #28.

  • Status changed to RTBC over 1 year ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    On second thoughts, I can fix that on commit.

  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Updating credits

    • larowlan committed f1fe67a8 on 10.0.x
      Issue #3145850 by smustgrave, natedouglas, nod_, Gauravvvv, s_leu,...
    • larowlan committed f908b84f on 10.1.x
      Issue #3145850 by smustgrave, natedouglas, nod_, Gauravvvv, s_leu,...
    • larowlan committed 7d195a3a on 9.5.x
      Issue #3145850 by smustgrave, natedouglas, nod_, Gauravvvv, s_leu,...
  • Status changed to Fixed over 1 year ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Fixed on commit

    diff --git a/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php
    index 75f6768dea9..0867f962c95 100644
    --- a/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php
    +++ b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php
    @@ -137,7 +137,7 @@ public function testTextSummaryRequiredBehavior() {
         $page = $this->getSession()->getPage();
         $summary_field = $page->findField('edit-' . $field_name . '-0-summary');
     
    -    $this->assertEquals(TRUE, $summary_field->isVisible(), 'Required summary is always shown.');
    +    $this->assertEquals(TRUE, $summary_field->isVisible());
       }
     
     }
    

    Committed to 10.1.x and backported to 10.0.x and 9.5.x

    Manually tested with a multi-cardinality field as there's some JS regarding that, but it need not run if the summary is optional - so all good.

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

Production build 0.71.5 2024