Problem/Motivation

One of the most awesome benefits of adding vertical tabs in Drupal 7 was the javascript that allowed people to see what the current values were without having to pop-open the fieldsets. This benefit has been lost by moving the tabs to the right hand column.

I did a little research into the development of this new display of vertical tabs, and it looks like the current values are supposed to be present - at least according to the screenshots shown in this issue - the one that got committed.

Missing summaries

Perhaps they were forgotten, or removed later for some other reason?

Proposed resolution

Put back the awesomeness that was vertical tabs - javascript revealing current values from within fieldsets. In Drupal 7.38 it's handled in /misc/collapse.js, line 56-101, propably doesn't work one-by-one to D8.

Remaining tasks

see above

User interface changes

see above

API changes

none

#1936700: Book module usability: Stop using vertical tabs

CommentFileSizeAuthor
#127 1936708-127.patch22.6 KBbnjmnm
#127 interdiff_123-127.txt2.11 KBbnjmnm
#126 1936708-126.patch22.63 KBayushmishra206
#126 interdiff_123-126.txt1.24 KBayushmishra206
#123 1936708-123.patch22.63 KBbnjmnm
#123 interdiff_121-123.txt2.47 KBbnjmnm
#121 displayblock.png24.98 KBbnjmnm
#121 1936708-121.patch22.01 KBbnjmnm
#121 interdiff_117-121.txt1.21 KBbnjmnm
#119 SevenTheme.png23.13 KBpaulocs
#119 ClaroTheme.png21.11 KBpaulocs
#117 1936708-117.patch22.37 KBbnjmnm
#117 interdiff_113-117.txt9.06 KBbnjmnm
#113 1936708-113.patch22.21 KBbnjmnm
#113 interdiff_111-113.txt9.6 KBbnjmnm
#111 interdiff_108-111.txt9.01 KBbnjmnm
#111 1936708-111.txt22.26 KBbnjmnm
#110 interdiff__108-110.txt9.01 KBbnjmnm
#108 1936708--108.patch22.27 KBbnjmnm
#108 interdiff__106-108.txt10.04 KBbnjmnm
#106 interdiff_100-105.txt3.49 KBbnjmnm
#106 1936708-105.patch20.1 KBbnjmnm
#100 1936708-97.patch17.89 KBbnjmnm
#100 interdiff_94-97.txt2.45 KBbnjmnm
#100 1936708-97-TEST-ONLY.patch2.49 KBbnjmnm
#97 1936708-97-TEST-ONLY.patch2.49 KBbnjmnm
#97 interdiff_94-97.txt2.45 KBbnjmnm
#97 1936708-97.patch17.89 KBbnjmnm
#94 interdiff_90-94.txt26.04 KBbnjmnm
#94 1936708-94.patch15.41 KBbnjmnm
#94 Bartik-BlockVisibility.png88.55 KBbnjmnm
#94 Bartik-EntityMeta.png95.06 KBbnjmnm
#94 Claro-EntityMeta.png94.49 KBbnjmnm
#94 Claro-BlockVisibility-Wide.png84.03 KBbnjmnm
#94 Claro-BlockVisibility-Narrow.png83.81 KBbnjmnm
#94 Seven-BlockVisibility-Wide.png86.03 KBbnjmnm
#94 Seven-BlockVisibility-Narrow.png81.25 KBbnjmnm
#94 Seven-EntityMeta.png96 KBbnjmnm
#92 Seven_theme_Safari.png87.32 KBpriyanka.sahni
#92 Seven_theme_Chrome.png118.63 KBpriyanka.sahni
#92 Claro_theme_Safari.png87.26 KBpriyanka.sahni
#92 Claro_theme_Chrome.png103.21 KBpriyanka.sahni
#92 Bartik_theme_Safari.png83.05 KBpriyanka.sahni
#92 Bartik_theme_Chrome.png91.73 KBpriyanka.sahni
#90 interdiff_88-90.txt2.71 KBvsujeetkumar
#90 1936708_90.patch11.11 KBvsujeetkumar
#88 1936708-88.patch8.78 KBmrinalini9
#79 1936708-79.patch8.61 KBvacho
#70 Captura de ecrã 2017-09-29, às 13.50.29.png110.32 KBjoum
#66 1936708-66.patch8.24 KBmbroere
#65 Selection_243.png64.52 KBkwoxer
#54 core-js-details-summary-1936708-54.patch4.85 KBespurnes
#52 core-js-details-summary-1936708-52.patch4.43 KBespurnes
#48 Tested in Microsoft edge.jpg40.01 KBjaspreetsingh31
#48 Tested in FireFox browser.jpg49.22 KBjaspreetsingh31
#48 Tested in Chrome browser.jpg51.78 KBjaspreetsingh31
#47 firefox.png68.04 KBbendev
#47 safari.png62.45 KBbendev
#47 chrome.png52.62 KBbendev
#46 interdiff.txt3.26 KBnod_
#46 core-js-details-summary-1936708-46.patch4.6 KBnod_
#44 current_element_values-1936708-44.patch2.18 KBbendev
#43 current_element_values-1936708-40.patch1.75 KBbendev
#41 Firefox browser_screenshot.jpg52.48 KBjaspreetsingh31
#41 Doublearrow_bug_ChromeBrowser.jpg57.79 KBjaspreetsingh31
#40 Capture d’écran 2015-10-07 à 21.16.12.png49.1 KBbendev
#40 current_element_values-1936708-40.patch1.75 KBbendev
#33 d8-vertical-tab-summaries-1936708-33.patch982 bytesespurnes
#31 html-patch-14-and-23.jpg59.76 KBespurnes
#31 ui-patch-14-and-23.jpg45.4 KBespurnes
#27 chrome.png49.9 KBespurnes
#27 firefox.png67.45 KBespurnes
#23 screenshot-2015-09-26-14.42.08.png36.65 KBespurnes
#23 d8-vertical-tab-summaries-1936708-23.patch471 bytesespurnes
#19 d8-vertical-tab-summaries-1936708-19.patch500 bytesespurnes
#19 screenshot-2015-09-26-10.36.54.png34 KBespurnes
#14 d8-vertical-tab-summaries-1936708-5.patch2.64 KBnicolas@webstanz.be
#10 Screen-Shot2015-09-25.png57.71 KBsokru
#4 d8-vertical-tab-summaries-1936708-4.patch2.55 KBjustinchev
#4 vertical-tab-summaries.png32.61 KBjustinchev
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jenlampton’s picture

Issue summary: View changes

typo

yoroy’s picture

Issue summary: View changes

fixed img tag: srtc=" -> src="

yoroy’s picture

Issue summary: View changes

asd

yoroy’s picture

Not sure why that doesn't work. Here's the link to the image:

http://drupal.org/files/Screen%20Shot%202012-10-13%20at%2012.45.57%20AM.png

yoroy’s picture

Issue summary: View changes

still trying to fix img tag

rootwork’s picture

Issue summary: View changes

This appears to still be the case in 8.0.x dev, and seems like a real shame. What was apparently intended, as Jen points out and as is shown in the image, would make a lot of sense, and not having that information definitely seems like a usability regression.

The span meant for this information, with the class "summary," is empty. For instance, here's the code for the Menu Settings tab:

<details id="edit-menu" class="menu-link-form form-wrapper collapse-processed">
  <summary aria-expanded="" aria-controls="edit-menu" role="button">
    <a class="details-title" href="#edit-menu">
      <span class="details-summary-prefix visually-hidden">Show</span>
      Menu settings
    </a>
  <span class="summary"></span>
  </summary>
<div class="details-wrapper">
  [...]
</div>
</details>

The span with class "summary" is also being hidden with CSS:

.entity-meta details .summary {
  display: none;
}

The CSS comes from the last definition in entity-meta.css (in core/themes/seven/css/components) and has the comment "Hide JS summaries. @todo Rethink summaries." That was originally written in the patch from #1838114-23: Change node form’s vertical tabs into details elements (subsequently worked on and committed in #1838114-81: Change node form’s vertical tabs into details elements). It's not clear to me reading that issue why the summaries weren't working, but presumably the fact that they're empty is why they're being hidden.

If someone else is more familiar with that history, maybe they could suggest what/how we should rethink those summaries, because it'd be great to get them working again.

yoroy’s picture

Category: Task » Bug report

Thanks for the investigations. Seems like a bug at this point as it would be a usability regression to not bring summaries back.

justinchev’s picture

I've been taking a look at this and trying to see if I can find a working example. I've gone as far back as D8 Alpha 2 and it's not in there.

Seems that these threads are relevant:
https://www.drupal.org/node/1838114#comment-6952220 - See patch on comment #6 as it seems to have some reference to it.
https://www.drupal.org/node/1751312 - Talks about re-writing the JS behaviours relevant to this

Anyway having delved into the current beta1 code I see that there is what looks like references to creating summary info within this file, but I couldn't decipher exactly how it was supposed to work (bit over my head),:
/core/modules/node/node.js

Anyway I've added a bit of jQuery (see patch) which provides this basic functionality and could potentially be used as a basis. It's rather messy at the moment with inline CSS, and no translation options etc, but I didn't want to spend too much time at this stage without getting some input on whether this is a viable/good way to approach this (I suspect this could be done in a better way).

PS I see that this is logged under Component 'Seven Theme' although all I found Seven Theme was doing is creating the Summary bit that appears at the top of the Tabs where the Published, last saved, author and revision info is showing)

LewisNyman’s picture

Issue tags: +frontend, +JavaScript
LewisNyman’s picture

Component: Seven theme » javascript

This is not a Seven issue

nod_’s picture

Issue tags: +Novice

Not really novice, but let's see if someone is up for something a little challenging.

nod_’s picture

Status: Active » Needs work

Also patch in #4 needs quite a bit of work.

justinchev’s picture

Assigned: Unassigned » justinchev

Yeah that patch needs a lot of work, but if you think achieving this with JS is fine I'll have a tinker.

sokru’s picture

Issue summary: View changes
FileSize
57.71 KB
sokru’s picture

Issue summary: View changes
sokru’s picture

Issue summary: View changes
nicolas@webstanz.be’s picture

We try to apply the patch (#4) with git apply but it display an error.

error: while searching for:

  Drupal.behaviors.nodeDetailsSummaries = {
    attach: function (context) {
      var $context = $(context);
      $context.find('.node-form-revision-information').drupalSetSummary(function (context) {
        var $context = $(context);
nicolas@webstanz.be’s picture

Patch corrected with good indentations.

Also adds the Drupal T function. Ready to be improve.

Tks anansi
Mentored by Chipway

made @ DrupalConEur Barcelona

rootwork’s picture

Status: Needs work » Needs review

The last submitted patch, 4: d8-vertical-tab-summaries-1936708-4.patch, failed testing.

The last submitted patch, 4: d8-vertical-tab-summaries-1936708-4.patch, failed testing.

bendev’s picture

Status: Needs review » Needs work

tested patch in #14 . I can see the content between brackets but it is not updated.
Although I changed the url alias, it stays "No alias"

espurnes’s picture

Assigned: justinchev » espurnes
Status: Needs work » Needs review
FileSize
34 KB
500 bytes

After some time looking at the functionality I realised that it is working as expected. The problem is that there is a css property hidding the summary tag. No need to apply any patch to /core/modules/node/node.js

The css property is in line 57 of /core/themes/seven/css/components/entity-meta.css

.entity-meta details .summary {
 display: none; /* Hide JS summaries. @todo Rethink summaries. */
}

Proposed solution
Remove lines 57 to 59 of entity-meta.css file and style the summary tag using style guide documentation.

Remaining tasks
Define style for summary tag. There is no style information about this kind of element (https://groups.drupal.org/node/283223#Details_and_Accordion). Currently it's shown in uppercase and black.

espurnes’s picture

There two a discussions started 3 years ago related to this issue:
- https://www.drupal.org/node/1919956
- https://www.drupal.org/node/1838114#comment-6774686

No idea about the motivations to add display:none to summaries.

espurnes’s picture

Issue tags: +Barcelona2015

Added Barcelona2015 tag to the issue.

bendev’s picture

Status: Needs review » Needs work

I did the same check this morning in the plane (back from drupalcon barcelona)

I started from D7 and I I came to the same conclusion.
For those interested, the code is in the js of each module (corresponding to the tabs):

E.g : core/module/path/path.js
Drupal.behaviors.pathDetailsSummaries =
the same for pathauto etc...

By the way I tested your patch and it is ok.
I agree the style should likely be like on the first screenshot in the issue description...
todo @css

espurnes’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
471 bytes
36.65 KB

I checked the style of the summary element in D7:

  • It is not uppercase
  • It is in #666 color
  • It is in font-size: .846em

So maybe we can apply the same style in D8 in the entity-meta.css

.entity-meta details .summary {
  color: #666;
  text-transform: none;
  font-size: 0.85em;
}

I think it's better to not force to show the summary value in uppercase.

bendev’s picture

Status: Needs review » Reviewed & tested by the community

#23 tested.
this looks ok.

Thanks

bendev’s picture

Assigned: espurnes » Unassigned
bendev’s picture

Status: Reviewed & tested by the community » Needs work

It looks like it is working in firefox but neither in chrome nor in safari.
Could anyone else confirm?

espurnes’s picture

FileSize
67.45 KB
49.9 KB

I confirm the patch is working in firefox but not in chrome nor safari.

The next code is applied in firefox but not in the other browsers:

<a class="details-title" href="#edit-menu">
<span class="details-summary-prefix visually-hidden">Hide</span>
Menu settings
</a>
<span class="summary"> (Not in menu)</span>

Anyone can check why the html is different?

bendev’s picture

Issue summary: View changes
Issue tags: +browser compatibility

the code is in collapse.js locate in core/misc/ directory

sokru’s picture

Only webkit supports HTML5 <details> element and I dont know why following code (in collapse.js) is there in first place, but that's causing summaries not to be visible in Chrome.

125       if (Modernizr.details) {
126         return;
127       }
rootwork’s picture

#23 doesn't include the changes from #14. We need a patch that integrates that.

In terms of the font size, per #2045473: Improve visibility of Seven's smallest font elements the smallest we should make text is 1em. I agree on unsetting the all-caps text transform, but perhaps the parent item's text transform could be more specifically set so that we don't have one rule applying it and another rule removing it.

If you're curious about the source of this regression, see #2.

espurnes’s picture

applying #23 and #14 not solves the problem.

#14 adds additional markup and #23 just works in firefox... so it needs more work.

espurnes’s picture

I commented code from /core/misc/collapse.js and the summary is visible in firefox (40.0.3), Chrome (45.0.2454). and Safari (6.2.8).

125       if (Modernizr.details) {
126         return;
127       }

So we have to look deeper in this file and change the condition that prints the output.
Or maybe change the output to use different element than details or summary. Maybe a span or div?

Test with patch #23 applied.

Thanks sokru.

espurnes’s picture

I ckecked again the functionality without the modernizr.details code and it works perfect in firefox, chrome and safari.

caniuse.com

The element generates a simple no-JavaScript widget to show/hide element contents, optionally by clicking on its child element. (http://caniuse.com/#search=details)

Maybe the functionality show/hide is not working in some browsers but if the information is displayed this is not a problem from my point of view.

Other option is to use different tags like I said in #32, span or div tags can work.

Remaining tasks
- Test the functionality in other browsers
- Check if this patch affects other functionalities

espurnes’s picture

Status: Needs work » Needs review
bendev’s picture

I tested #33 and it works as you described

we could replace the return in the check by something inspired from this in order to allow some specific handling

// @js: Use Modernizr to check the navigator capacities
if( !Modernizr.details ) jQuery(“html”).addClass(“no-details”);

source http://html5doctor.com/the-details-and-summary-elements/

Modernizr.details returns
fierefox => false
chrome => true
safari => true

espurnes’s picture

Assigned: Unassigned » espurnes

working on bendev solution.

details is used to show/hide extra information in a way like an accordion does. This is css3 native (so, no need to use javascript). But right now just the following browsers support the details element:

Chrome 12+
Opera 15+
Safari 6+
iOS Safari 6.1+
Android Browser 4+
Blackberry Browser 10+
Opera Mobile 30+
Chrome dor android 45+
UC Browser for Android 9.9+

So IE, Edge, Firefox, Opera Mini, Firefox for Android and IE Mobile don't support it.

But at least in Firefox the open/close functionality doesn't work but the content is displayed. So the bendev approach extracted from here is a good option. We set a new class to tell the browser doesn't support details.

While I was writting this message I realised the classes .details or .no-details have been already setted to the html element. I can't find the code that adds these classes but they are there.

So no need to add the bendev code. I think patch #33 should work.

Remaining tasks
- Test the functionality in other browsers
- Check if this patch affects other functionalities

espurnes’s picture

Assigned: espurnes » Unassigned
espurnes’s picture

Ok the class is added by Modernizr.details.
But after applying #33 (that deletes the use of Modernizr.details in /core/misc/collapse.js) the class is added anyway. I can't find another place where Modernizr.details is called.

Aggregation of css and js is disabled and I cleared the cache.

Remaining tasks
- Test the functionality in other browsers
- Check if this patch affects other functionalities

source:https://modernizr.com/docs#using-modernizr-with-css

Using Modernizr with CSS
Modernizr's classes

By default, Modernizr sets classes for all of your tests on the root element ( for websites). This means adding the class for each feature when it is supported, and adding it with a no- prefix when it is not (e.g. .feature or .no-feature). This makes it super simple to add features in via progressive enhancement!

Say you include Modernizr's detection for CSS gradients. Depending on the browser, it will result in either or . Now that you know those two states, you can write CSS to cover both cases

bendev’s picture

In my option this can go RTBC

bendev’s picture

I noticed that the summary was missing on the comment tab
I adapted the corresponding JS to fix this

I propose the new patch in attachment for review

jaspreetsingh31’s picture

Status: Needs review » Needs work
FileSize
57.79 KB
52.48 KB

I have tested the patch in multiple browsers like Chrome ( version: 45.0.2454.101 ) , Firefox ( version:41.0.1) , Microsoft Edge and in terms of functionality it works fine. But In chrome browser, it shows twice arrows but seems fine on FireFox and Microsoft Edge browser.

For sake reference, Please find the attachments.
doublearrow_bug_chromebrowser.jpg & Firefox browser_ screenshot.jpg

Thanks
Jaspreet singh

bendev’s picture

OK I think we finally understand the point.

we need to use the no-details class added automatically to firefox-like browsers (see #36 and #37) in order to display the sumarry arrows so that they don't appear twice in the other browsers...

I will work on this soon

bendev’s picture

Version: 8.0.x-dev » 8.1.x-dev
FileSize
1.75 KB

Here is the reroll of patch #40 for 8.1.X-dev

what remain to be done is #41
+ check the summaries from menu which are gone (perhaps another issue for this)

bendev’s picture

Status: Needs work » Needs review
FileSize
2.18 KB

Sorry wron patch in #43

here it is with the fix for the double arrows . this one needs review

Can anyone confirm me if we are supposed to work against 8.1.x-dev as I assumed ?
+to do create another issue for the summary of menu tab

nod_’s picture

Version: 8.1.x-dev » 8.0.x-dev
Status: Needs review » Needs work

8.1.x is outdated, nothing is happening there, should do the work on 8.0.x since Patch doesn't apply and we can't test it :)

nod_’s picture

Status: Needs work » Needs review
FileSize
4.6 KB
3.26 KB

Polished the code, it works both with chrome and firefox. We could even split up the code more but let's leave that for another time.

Fixed a few inacurate comments and remaining eslint issues.

bendev’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
52.62 KB
62.45 KB
68.04 KB

testd in chrome firefox and safari

jaspreetsingh31’s picture

I have tested this double arrow issue on multiple browsers like chrome, Firefox, Microsoft edge and it works fine.
Status: Done
For sake reference, Please find the attachments.

Thanks

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 46: core-js-details-summary-1936708-46.patch, failed testing.

nod_’s picture

emma.maria’s picture

Removing the Novice tag as this issue needs some new direction for what the new patch needs to contain.

espurnes’s picture

droplet’s picture

Compare to #2493957: Add back errors support to native HTML5 details tag:

- Both patched little more than main problem of issue thread.
- Both are good patches but slightly different on few code style. #2493957 is more close to other core scripts. But I like this patch move following code into `CollapsibleDetails`

+++ b/core/misc/collapse.js
@@ -12,11 +12,18 @@
+      this.$node.addClass('collapse-processed');

From my quick review of this patch, only missing following code from another issue thread:

+++ b/core/themes/classy/css/components/collapse-processed.css
@@ -30,3 +30,6 @@
+.collapse-processed .details-title {
+  color: #333;
+}

To standardize the color.

espurnes’s picture

I added suggestion from droplet #53 to collapse-processed.css

droplet’s picture

Status: Needs work » Needs review
Issue tags: +Needs manual testing

The last submitted patch, 44: current_element_values-1936708-44.patch, failed testing.

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.

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

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

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

joelpittet’s picture

Issue tags: +Novice

Adding Novice for manual testing, needs screenshots.

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

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should 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.

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

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should 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.

joelpittet’s picture

Issue tags: +Vienna2017, +Needs reroll

This will need a re-roll and manual testing. Maybe manual test first to make sure this is still an issue to be solved before rerolling.

mbroere’s picture

Assigned: Unassigned » mbroere
darren.fisher’s picture

I'm going to attempt to re-roll patch 54 now for 8.4.

kwoxer’s picture

FileSize
64.52 KB

On Drupal 8.4.0-dev there is no such information. I have no patch running.

See that shot to make sure I was on the right page or view:
no hint about the main infos

So which patch should I test?

mbroere’s picture

Version: 8.4.x-dev » 8.5.x-dev
FileSize
8.24 KB

Tested manually and re-rolled the patch. Works local.

mbroere’s picture

Assigned: mbroere » Unassigned
darren.fisher’s picture

I'll test the patch in #66. Glad you've managed to re-roll.

Sutharsan’s picture

Issue tags: -Needs reroll
joum’s picture

Hi everyone! I'm at Drupalcon Vienna2017 and I'm a bit confused by the status of this issue.

I just applied the 1936708-66.patch against 8.5.x-dev and it seems to be working as intended. (see screenshot)

What else needs to be done? (First time sprinter, instructions unclear... :)

EDIT:

Validated correct function in MacOSX 10.12.6 (16G29) using
Chrome 60.0.3112.113;
Safari 11.0 (12604.1.38.1.7);
Firefox 52.0.2 (64-bit)

joum’s picture

Status: Needs review » Reviewed & tested by the community
darren.fisher’s picture

Confirming that patch in #66 is working for me too.

tonifisler’s picture

Confirming that it works for me too. 👍

mbroere’s picture

larowlan’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -Needs issue summary update, -Needs manual testing +Needs tests

We have JavaScript testing in core now, we need a test here so we don't lose it again.

Thanks everyone

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.

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

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

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

vacho’s picture

Rebasing

aleevas’s picture

Status: Needs work » Needs review

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

tvb’s picture

Issue tags: -JavaScript +JavaScript

Patch applies cleanly to 8.9.x-dev.

tvb’s picture

Issue tags: -Novice

After applying the patch from #79 and checking out a node edit form:
1) the span tags with class summary are not empty (good),
2) but the span contents are not displayed in the UI (not good).

(Seven theme, on Firefox and on Chrome)

Commenting out display: none; produces a result similar to the result in #70, but this seems to conflict with the issue mentioned in the preceding @todo;

/**
 * Hide JS summary from the details polyfill to make it consistent with native
 * details elements.
 *
 * @todo Consider removing this after https://www.drupal.org/node/2493957 has
 *   been solved.
 */
.entity-meta .seven-details .summary {
  display: none;
}

Not sure what the status should be, Removing the 'Novice' tag.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

nod_’s picture

Status: Needs review » Needs work

doesn't apply cleanly on 9.1.x

Like tvb said, Need to remove the CSS that hides the summay, otherwise this patch doesn't change anything visually.

nod_’s picture

mrinalini9’s picture

Assigned: Unassigned » mrinalini9
mrinalini9’s picture

Assigned: mrinalini9 » Unassigned
Status: Needs work » Needs review
FileSize
8.78 KB

Rerolled patch for 9.1.x and removed the CSS that hides the summary as mentioned in #85, please review.

Status: Needs review » Needs work

The last submitted patch, 88: 1936708-88.patch, failed testing. View results

vsujeetkumar’s picture

Status: Needs work » Needs review
FileSize
11.11 KB
2.71 KB

Test Fixed, Please review.

priyanka.sahni’s picture

Assigned: Unassigned » priyanka.sahni
priyanka.sahni’s picture

Verified and tested by applying the patch #90.It was applied successfully. Can be moved to RTBC.
Had one observation for the Claro theme the text didn't display.

Steps to test -
1. Go to the admin site.
2. Go to admin/appearance.
3. Select theme Bartik/Claro/Seven/Default
4. Edit any of the created content type.
5. Verify.

Seven_theme_Chrome
After Patch

Seven_theme_Safari
After Patch

Bartik_theme_Safari
After Patch

Bartik_theme_Chrome
After Patch

Claro_theme_Safari
After Patch

Claro_theme_Chrome
After Patch

nod_’s picture

Status: Needs review » Needs work

When you create a JavaScript patch please make sure to always run yarn run lint:core-js-passing before sending the patch, for the whole workflow have a look here: https://www.drupal.org/node/2986680

Lately the JS patches have had issues with not following core standards so please make sure to use the tools we have in core to reduce the workload of reviewers, Thank you.

Claro overrides some things about collapse.js, needs to be fixed.

bnjmnm’s picture

I noticed most of the logic was modifying collapse.js. That is a polyfill for browsers that don't support <details>. Browsers that didn't need the polyfill were getting some of it anyway, and I think it may prove difficult to maintain. I opted to move the functionality to a dedicated JS file.

The CSS changes are pretty straightforward. Claro needed some additional JavaScript changes to remove its own workarounds for this issue, otherwise summaries would be duplicated in some instances.

bnjmnm’s picture

Status: Needs work » Needs review
bnjmnm’s picture

bnjmnm’s picture

Added test. The test addition is the only change, but there is a dedicated interdiff as a bit of formatting was changed.

Status: Needs review » Needs work

The last submitted patch, 97: 1936708-97-TEST-ONLY.patch, failed testing. View results

bnjmnm’s picture

Status: Needs work » Needs review

1936708-97-TEST-ONLY failing was expected, so switching back to NR.

bnjmnm’s picture

Re-adding with the Test-only patch first so testbot doesn't kick back to Needs review.

The last submitted patch, 100: 1936708-97-TEST-ONLY.patch, failed testing. View results

nod_’s picture

Status: Needs review » Needs work

you can name it --FAIL.patch instead of TEST-ONLY.patch. It'll do what you want :)

Looking at it, it definitely should be in the collapse file. Because now there are a lot of duplications. There is a theme function in the details.js file, but the same thing is hardcoded in the collapse.js file. What is done in details.js is a light version of collapse.js. some of what's in claro details.js could be in core, I don't see why we can't have summary tags trigger when hitting space everywhere.

bnjmnm’s picture

Issue tags: +Needs followup

Because now there are a lot of duplications

Ah, that's right, collapse,js is a polyfill but it doesn't replace details.js, it runs in addition to it.

Looking at it, it definitely should be in the collapse file.

My concern is that this file has been long understood as strictly being a polyfill for browsers that don't support <details>. There has been interest in replacing this with a different polyfill #1839158: Replace collapse.js with a proper polyfill for <details>, and this would be made far more difficult by splicing in functionality that applies to all browsers.

If there is still a preference to include the fix in collapse.js, there would be a need to edit several comments in the file that reference itself as a polyfill, which it would no longer be, starting with @file,

/**
 * @file
 * Polyfill for HTML5 details elements.
 */

My preference would be to address the duplication by removing the summary logic in collapse.js, and make sure that the new summary logic is compatible with the collapse.js polyfill

some of what's in claro details.js could be in core

I'm I correct in interpreting that this is a reference to the shim that's already there, not the changes i the patch? That does seem like something better applied to core. I believe it would be out of scope here, but tagging with needs followup as a reminder to create that issue.

nod_’s picture

Right, like you said, moving the code for setupSummary from collapse.js to details.js is good.

And yes about the claro code, it's about what already exists you're correct.

bnjmnm’s picture

Status: Needs work » Needs review
Issue tags: -Needs followup

Created followup #3160367: Move Claro's polyfills in details.es6.js to core for the claro functionality that should be in core.

Removed the now-redundant code from the collapse polyfill.

bnjmnm’s picture

The patches that should have been with #105

lauriii’s picture

Status: Needs review » Needs work
  1. +++ b/core/misc/collapse.es6.js
    @@ -24,8 +24,6 @@
    -    // Initialize and setup the summary,
    -    this.setupSummary();
    

    Checked that there aren't any instances where it would be expected that this.setupSummary gets called http://grep.xnddx.ru/search?text=setupSummary&filename=

  2. +++ b/core/misc/details.es6.js
    @@ -0,0 +1,110 @@
    +  function DetailsElement(node) {
    ...
    +  Drupal.DetailsElements = DetailsElement;
    

    I'm pondering if we should make this more specific to the functionality we're providing. The current names sound very generic 🤔

  3. +++ b/core/misc/details.es6.js
    @@ -0,0 +1,110 @@
    +      setupSummary() {
    ...
    +      setupLegend() {
    

    What are the benefits of splitting this into two functions?

  4. +++ b/core/misc/details.es6.js
    @@ -0,0 +1,110 @@
    +  Drupal.theme.detailsSummarySummary = () => `<span class="summary"></span>`;
    ...
    +  Drupal.theme.detailsSummarySummaryText = text => (text ? ` (${text})` : '');
    

    detailsSummarySummary sounds a bit strange. Would be great if we come up with a name that doesn't require using summary twice.

bnjmnm’s picture

Status: Needs work » Needs review
FileSize
10.04 KB
22.27 KB

This addresses #107

An explanation for how I addressed item 3:

What are the benefits of splitting [setupSummary(), setupLegend()] into two functions?

It was two separate functions in collapse.js, but looks like the separation was no longer needed after #1685140: Refactor collapse.js. They were separate to address cover Drupal's former use of fieldset+legend to achieve details+summary like behavior. I did some refactoring of both details and the polyfill to make this clearer, and checked http://grep.xnddx.ru/ to ensure the refactoring wouldn't cause problems for contrib.

lauriii’s picture

Status: Needs review » Needs work
Issue tags: -Needs tests

Based on the discussion on Slack with @bnjmnm we should still consider if we could improve the naming to be more descriptive on what is actually being done. DetailsEnhanced sounds like the details element is enhanced which is not 100% accurate because what we're actually doing, is just generating summary for the details based on form input.

bnjmnm’s picture

Status: Needs work » Needs review
FileSize
9.01 KB

Did some renaming (and refactoring due to it)

bnjmnm’s picture

FileSize
22.26 KB
9.01 KB

Forgot the patch in 110 😛

nod_’s picture

Status: Needs review » Needs work

Synopsis does not work for me: It's a complicated word, the meaning is not obvious, it's hard to say (for me at least). For exemple I honestly do not know how to pronounce: synopsized.

I would suggest brief, then we have names like: DetailsBriefSummary, Drupal.theme.detailsBriefSummary, Drupal.theme.detailsBriefSummaryText, etc. It makes sense when used both as a noun or an adjective. It's not an usual word used in webdev though.

A better one might be outline, benefit is that it's a well known term in HTML land, accessibility, in CSS (with a different meaning but still the word is already known). And it doesn't rely on a pun to be useful. DetailsSummaryOutline it's more descriptive, it's an outline inside a details inside a summary.

In any case, not synopsis.

bnjmnm’s picture

Status: Needs work » Needs review
FileSize
9.6 KB
22.21 KB

Those are both much better options that synopsis, thanks!
I opted for outline. Both brief and outline have multiple meanings that could potentially be confusing, but when seen in context I think the confusion for "outline" is mitigated more quickly.

nod_’s picture

We can probably get away with DetailsOutline, the fact that it's in the summary element is kind of an implementation detail. In any case, much better already, thanks!

lauriii’s picture

Since this summary is at least at the moment only being used in forms, how about we call it DetailsFormSummary? Or if we think we should be open to outside of form implementations, we could use DetailsGeneratedSummary. The reason I like summary is that the API is still using the word summary in other places, for example drupalGetSummary and summaryCallback.

bnjmnm’s picture

Status: Needs review » Needs work

At the Claro weekly check-in we discussed the naming and agreed on DetailsSummmarizedContent. Summary is the most accurate term, and using "Summarized" eliminated the confusion with the <summary> element. The patch that renames it should also see if any comments need to be changed to reflect the renaming.

bnjmnm’s picture

Status: Needs work » Needs review
FileSize
9.06 KB
22.37 KB

Renamed per #116

paulocs’s picture

That was fast! I was pretending to assign the issue to me when I finished to read comment #116 but I was to slow hahaha
So if patch #117 passes on tests, I will test it. Thanks @bnjmnm!

Cheers, Paulo.

paulocs’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
21.11 KB
23.13 KB

Patch #117 looks good to me!

I tested with Seven and Claro Theme. (I attached images to prove it)
Another point is that the patch should use DetailsSummmarizedContent term and I can confirm that the patch do it right.
All comments mention the right term too.

Set to RTBC.

Cheers, Paulo.

lauriii’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/misc/details-summarized-content.es6.js
    @@ -0,0 +1,105 @@
    +  $.extend(
    +    DetailsSummarizedContent,
    ...
    +      instances: [],
    +    },
    +  );
    

    We are not adding the instances to the list at the moment so this is always empty.

  2. +++ b/core/themes/claro/js/details.es6.js
    @@ -55,4 +55,23 @@
    +  Drupal.theme.detailsSummarizedContentText = text => text || '';
    

    Should we prepend a whitespace to the beginning of the text like the default instance of this theme function does?

bnjmnm’s picture

Status: Needs work » Needs review
FileSize
1.21 KB
22.01 KB
24.98 KB

#120.1 Removed that extend.

#120.2 Whitespace shouldn't be appended in Claro as its design has the extended summary is enclosed in a block so it appears on the next line.

nod_’s picture

Status: Needs review » Needs work
+++ b/core/misc/details-summarized-content.es6.js
@@ -0,0 +1,93 @@
+  Drupal.behaviors.detailsSummary = {
+    attach(context) {
+      const $detailsElements = $(context)
+        .find('details')
+        .once('details');
+      $detailsElements.map(
+        (index, details) =>
+          // eslint-disable-next-line no-new
+          new DetailsSummarizedContent(details),
+      );
+    },
+  };

The instances property was used here for 2 reasons: 1. allow scripts to access the created objects in case they need an override of some kind. 2. not have the eslint warning about using new for sideeffects.

We should keep the created instances so they're accessible from the outside so I'd do:

  Drupal.behaviors.detailsSummary = {
    attach(context) {
      const $detailsElements = $(context)
        .find('details')
        .once('details');

      DetailsSummarizedContent.instances = DetailsSummarizedContent.instances.concat(
        $detailsElements
          .map((index, details) => new DetailsSummarizedContent(details))
          .get(),
      );
    },
  };

  Drupal.DetailsSummarizedContent = DetailsSummarizedContent;
bnjmnm’s picture

Status: Needs work » Needs review
FileSize
2.47 KB
22.63 KB

Thanks @nod_, that explanation helps make sense of why it's done and better way to do it.

nod_’s picture

Status: Needs review » Reviewed & tested by the community

That's good with me :) thanks

lauriii’s picture

Status: Reviewed & tested by the community » Needs work

This looks pretty good for me too. Here's few minor changes we still have to do. Feel free to move this back to RTBC once they have been addressed.

  1. +++ b/core/themes/seven/css/components/entity-meta.css
    @@ -59,14 +59,13 @@
    +
    
    themes/seven/css/components/entity-meta.css
     72:1  ✖  Expected no more than 1 empty line   max-empty-lines
    
  2. +++ b/core/themes/claro/css/components/accordion.pcss.css
    @@ -34,13 +34,8 @@
    +  color: var(--color-davysgrey);
    
    +++ b/core/themes/claro/css/components/details.css
    @@ -597,18 +597,11 @@ rgba(0, 0, 0, 0.1);
    +  color: var(--color-davysgrey);
    

    These are referring to a non-existing variable. These should be renamed to --color-davysgray.

ayushmishra206’s picture

Status: Needs work » Needs review
FileSize
1.24 KB
22.63 KB

Made the changes suggested in #125. Please review

bnjmnm’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
2.11 KB
22.6 KB

Thanks @ayushmishra206

In #126
1. Updates the source accordion.pcss.css, but the complied version isn't present and the unchanged CSS would be loaded
2. Changes the compiled details.css, when the changes could be made to details.pcss.css then complied to details.css.

More on how Claro uses PostCSS to build CSS can be found here https://www.drupal.org/node/3084859

Updated patches attached and returning to RTBC as #125 said that would be fine.

  • lauriii committed 6e6ad99 on 9.1.x
    Issue #1936708 by bnjmnm, espurnes, bendev, nod_, justinchev,...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Committed 6e6ad99 and pushed to 9.1.x. Thanks!

Status: Fixed » Closed (fixed)

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