Problem/Motivation

Currently the Secondary tabs are using the wrong size, spacing and font-size, taking too much vertical space:

Proposed resolution

Correct secondary tabs styles according to the design system. Full specs can be checked on Figma, and here's an screenshot:

User interface changes

Font size will be reduced and vertical spacing will be smaller

Test instructions

- /admin/content
- /admin/people

CommentFileSizeAuthor
#79 interdiff.txt1.04 KBlauriii
#72 Screenshot-2.png28.28 KBnitesh624
#72 screenshot1.png38.05 KBnitesh624
#71 Screenshot 2020-05-07 at 8.02.43 PM.png187.96 KBsauravk
#71 interdiff-64-71.txt2.8 KBsauravk
#71 3097651-71.patch5.29 KBsauravk
#65 selected_8586.png105.84 KBKondratievaS
#64 Screenshot 2020-04-27 at 10.10.52 AM.png95.82 KBsauravk
#64 interdiff-58-64.txt990 bytessauravk
#64 3097651-64.patch4.26 KBsauravk
#62 Screen Shot 2020-04-24 at 14.59.55.png12.24 KBlauriii
#61 Annotation 2020-04-24 060047.png21.81 KBBhumikaVarshney
#60 before.png78.57 KBshaktik
#58 interdiff_53-58.txt513 bytessauravk
#58 3097651-58.patch4.13 KBsauravk
#54 selected_8480.png70.34 KBKondratievaS
#53 interdiff_51-53.txt453 bytesNeslee Canil Pinto
#53 3097651-53.patch4.04 KBNeslee Canil Pinto
#51 interdiff_47-51.txt317 bytesNeslee Canil Pinto
#51 3097651-51.patch3.91 KBNeslee Canil Pinto
#50 Screen Shot 2020-04-07 at 16.08.41.png56.11 KBlauriii
#48 selected_8325.png168.77 KBKondratievaS
#47 3097651-47.patch3.87 KBkostyashupenko
#45 drupal-claro-9d.JPG16.76 KBKrzysztof Domański
#44 drupa-claro-9c.JPG60.6 KBKrzysztof Domański
#44 drupa-claro-9a.JPG64.18 KBKrzysztof Domański
#44 drupa-claro-9b.JPG118.67 KBKrzysztof Domański
#41 selected_7804.png131.96 KBKondratievaS
#40 Screen Shot 2020-02-03 at 14.05.11.png138.96 KBlauriii
#38 interdiff_34-38.txt3.15 KBszalapski.adam@gmail.com
#38 3097651-38.patch3.27 KBszalapski.adam@gmail.com
#37 drupal-dgcw.JPG29.83 KBKrzysztof Domański
#34 interdiff_3097651-32-3097651-34.txt358 bytesszalapski.adam@gmail.com
#34 3097651-34.patch903 bytesszalapski.adam@gmail.com
#32 3097651-32.patch975 byteskishor_kolekar
#32 interdiff-3097651-28-32.txt472 byteskishor_kolekar
#32 Screenshot 2020-01-17 at 10.38.55 PM.png275.96 KBkishor_kolekar
#32 Screenshot 2020-01-17.png314.49 KBkishor_kolekar
#30 Screenshot 2020-01-13 at 4.01.04 PM.png112.42 KBnaresh_bavaskar
#28 3097651-25-303097651-28_interdiff.txt623 byteskishor_kolekar
#28 3097651-28.patch866 byteskishor_kolekar
#25 interdiff_18-25.txt430 bytesravi.shankar
#25 3097651-25.patch900 bytesravi.shankar
#22 interdiff-3097651-18-3097651-20.txt322 byteskishor_kolekar
#20 3097651-20-Correct-secondary-tabs-size.patch900 byteskishor_kolekar
#20 3097651#comment-13413482.1.png183.99 KBkishor_kolekar
#18 Screenshot 2020-01-07 at 9.58.45 AM.png52.05 KBsibustephen
#18 3097651-18-Correct-secondary-tabs-size.patch470 bytessibustephen
#14 admin:people.png98.3 KBnaresh_bavaskar
#14 admin:content.png97.02 KBnaresh_bavaskar
#13 afterapply_patch_comment.png24.98 KBVinodhini.E
#13 afterapply_patch_content.png27.4 KBVinodhini.E
#11 interdiff_5-11.txt1.53 KBreinchek
#11 3097651-11.patch1.6 KBreinchek
#11 Schermata da 2019-12-17 17-16-52.png19.49 KBreinchek
#11 Schermata da 2019-12-17 17-17-02.png23.13 KBreinchek
#5 3097651-5.patch906 bytesreinchek
#5 Schermata da 2019-12-17 10-36-44.png42.52 KBreinchek
ok-tabs.png43.33 KBckrina
wrong-secondary-tabs.png48.87 KBckrina
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ckrina created an issue. See original summary.

ckrina’s picture

Issue summary: View changes

Adding Figma specs link.

ckrina’s picture

Issue summary: View changes
lauriii’s picture

Issue tags: +Novice
reinchek’s picture

I've applyed the css spacer modification.
CSS Space modification.

reinchek’s picture

Status: Active » Needs review
lauriii’s picture

Status: Needs review » Needs work
+++ b/core/themes/claro/css/components/content-header.css
@@ -55,7 +55,7 @@
 .content-header {
...
-  margin-bottom: 2rem;
+  margin-bottom: 1rem;

I'm not sure if we can just change the margin of the content header because of the margin specified in the content header is still 2rem. I assume the margin should be 1rem only when there are tabs.

reinchek’s picture

I'm not sure too... but actually claro doesn't discriminate the margin when there're and there aren't the tabs. The only way to change the tabs space (margin) is to reduce .content-header margin-bottom rule.
I will wait for explainations ...

have a nice day. :)

lauriii’s picture

Agreed that it's not clear. I asked for clarification from @ckrina who is one of the designers and the author of this issue.

ckrina’s picture

Yes, I confirm this space should be smaller when there are secondary tabs because their internal padding leaves enough top visual space.

I'd say if you want to change this bottom margin as a general rule you should then either:

  • change the top margin of the elements you can find in this position (Titles, Admin Lists(/admin/config), Messages, text...
  • conditionally add a class on a header's parent element when the local tasks are present

Although the first option might have too many open options.

reinchek’s picture

@ckrina maybe this could be a nice solution.
I've added a little piece of js code inside the nav-tabs.js library that add the ".with-secondary-tabs" class to the only when really there are the secondary tabs.

Attached the screenshots that show the behaviors.
With 2rem margin-bottom
Without 2rem margin-bottom

The code that add the discriminant class is:

// If the current iteration regards the second tabs level then apply a class 
// to the <header> to prevent 2rem margin space.
if (i === 1) {
  var $contentHeader = $('header.content-header');
  $contentHeader.addClass('with-secondary-tabs');
}
.content-header.with-secondary-tabs {
  margin-bottom: 1rem;
}
reinchek’s picture

Status: Needs work » Needs review
Vinodhini.E’s picture

#11, I have reviewed the patch and its working for me. I am attaching the screenshot after applying the patch.

naresh_bavaskar’s picture

+1 RTBC
#11 Patch works for me.
admin/content
admin/content

naresh_bavaskar’s picture

Status: Needs review » Reviewed & tested by the community
lauriii’s picture

Status: Reviewed & tested by the community » Needs work

I'm not sure if we need JavaScript to get this done given that this isn't really interactive. Let's try to come up with a CSS only solution for this.

reinchek’s picture

I've tried, before the js solution, to handle the issue with pure css solution. But as you can see i've failed!
The other thing that conviced me to adopt a js solution it was the fact that in another place (if i remember right) also was used to resolve a similar issue.

(ps: happy new year)

sibustephen’s picture

Hi, have attached a screenshot where the space seems to be good, when we reduce it to 1rem, have raise a patch for the same, do review.

kishor_kolekar’s picture

Assigned: Unassigned » kishor_kolekar
kishor_kolekar’s picture

I have created a patch. Below points are implemented in this patch:

  • Reduced the margin-bottom of header to 1rem(16px) as per the requirement in figma designs.
  • Removed the padding-top of secondary tabs as it was adding the space of 6px in the vertical spacing between primary and secondary menu tabs.

Kindly review the patch and screenshot attached.

kishor_kolekar’s picture

Assigned: kishor_kolekar » Unassigned
Status: Needs work » Needs review
kishor_kolekar’s picture

Adding interdiff for the patch in comment #20.

sibustephen’s picture

@kishor_kolekar can you reroll my patch #18 and then add your code for fix with interdiff, in order to track the changes.

sibustephen’s picture

Status: Needs review » Needs work
ravi.shankar’s picture

Status: Needs work » Needs review
FileSize
900 bytes
430 bytes

Here I have re-rolled patch #18
Made changes those done in patch #20 and added interdiff.

lauriii’s picture

Status: Needs review » Needs work

Unfortunately, this approach doesn't match with the style guide. See #2.

sibustephen’s picture

Assigned: Unassigned » sibustephen
kishor_kolekar’s picture

previously added the code in incorrect file , so added the code in correct file and created the patch with the interdiff

naresh_bavaskar’s picture

Assigned: sibustephen » naresh_bavaskar
Status: Needs work » Needs review
naresh_bavaskar’s picture

Assigned: naresh_bavaskar » Unassigned
Status: Needs review » Reviewed & tested by the community
FileSize
112.42 KB

#28 applied successfully. The secondary tab size is looking good to me.

lauriii’s picture

Status: Reviewed & tested by the community » Needs work

Unfortunately, we can't simply just change the margin of the content header because of the margin specified in the content header is still 2rem. The margin should be 1rem only when there are tabs.

AkashKumar07’s picture

Status: Needs work » Needs review
szalapski.adam@gmail.com’s picture

jordanwood’s picture

Patch from #34 applied cleanly and matches the proposed resolution.

hotwebmatter’s picture

This looks good, passes tests and meets specification. RTBC+1

Krzysztof Domański’s picture

Status: Needs review » Needs work
FileSize
29.83 KB

Thanks all for working on Claro theme!

1. @Adam Szałapski At the DGCW, I mentioned that drupal does not use compilers to generate css files. I was wrong.

Since Drupal 8.8.x we're using PostCSS for compiling creating CSS so we also need to change *.pcss.css files. See Drupal core using PostCSS for development.

2. Margin when there are no secondary tabs. It is a bit problematic.

spaces in design

Unfortunately, we can't simply just change the margin of the content header because of the margin specified in the content header is still 2rem. The margin should be 1rem only when there are tabs.

@lauriii Let's add 2rem space to .page-content. Then we can use a 1rem space to .content-header. What do you think about it?

--- a/core/themes/claro/css/layout/layout.pcss.css
+++ b/core/themes/claro/css/layout/layout.pcss.css
@@ -1,7 +1,8 @@
 /**
- * Add spacing to bottom of pages
+ * Add spacing to bottom and top of pages.
  */
 .page-content {
+  margin-top: 2rem;
   margin-bottom: 80px;
 }
--- a/core/themes/claro/css/components/content-header.css
+++ b/core/themes/claro/css/components/content-header.css
@@ -55,7 +55,7 @@

 .content-header {
   overflow: hidden;
-  margin-bottom: 2rem;
+  margin-bottom: 1rem;
   padding: 1.5rem 0 0;
   background-color: #f3f4f9;
 }
szalapski.adam@gmail.com’s picture

Status: Needs work » Needs review
FileSize
3.27 KB
3.15 KB

Thanks, Krzysztof Domański for valuable information about PostCSS configuration and few tips to fix spacing issues. Please review my newest patch.

Krzysztof Domański’s picture

Status: Needs review » Reviewed & tested by the community

Tested manually. Looks good to me.

lauriii’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs review
FileSize
138.96 KB

The current patch increases margin on the bottom of the tabs on mobile. Is this intentional?

KondratievaS’s picture

FileSize
131.96 KB

Spacing between tabs is OK

expected

ckrina’s picture

Hi @KondratievaS, as @lauriii is pointing, the spacing was smaller on mobile/small devices where we have less space. And as per designs, it should still be smaller:
https://www.figma.com/file/OqWgzAluHtsOd5uwm1lubFeH/Drupal-Design-system...

The reason behind this is because in smaller devices we have less space, so we need to leave less spacing.

Thanks for working on this!

KondratievaS’s picture

Status: Needs review » Needs work
Krzysztof Domański’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
118.67 KB
64.18 KB
60.6 KB

The current patch increases margin on the bottom of the tabs on mobile. Is this intentional?

1. Spaces on mobile have been changed according to the Drupal Design system.

secondary tabs for mobile
secondary tabs for mobile

2. Also the space above the "Add content" button is still the same.

content page on mobile

Krzysztof Domański’s picture

Status: Reviewed & tested by the community » Needs work
FileSize
16.76 KB

Oh right, it needs work.

spaces

kostyashupenko’s picture

Assigned: Unassigned » kostyashupenko
kostyashupenko’s picture

Assigned: kostyashupenko » Unassigned
Status: Needs work » Needs review
FileSize
3.87 KB
KondratievaS’s picture

FileSize
168.77 KB

Tested patch from #47 and result is OK

OK

KondratievaS’s picture

Status: Needs review » Reviewed & tested by the community
lauriii’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
FileSize
56.11 KB

Thank you all for working on this! This is great progress.

+++ b/core/themes/claro/css/layout/layout.pcss.css
@@ -1,7 +1,9 @@
 .page-content {
+  margin-top: 2rem;

It seems like this should be 1.5rem in mobile.

Neslee Canil Pinto’s picture

Status: Needs work » Needs review
FileSize
3.91 KB
317 bytes
lauriii’s picture

Status: Needs review » Needs work
+++ b/core/themes/claro/css/layout/layout.pcss.css
@@ -3,7 +3,7 @@
-  margin-top: 2rem;
+  margin-top: 1.5rem;

Thank you! We shouldn't remove the 2rem completely because it is the correct value for desktop. We should use media query for allowing this property to take effect on large viewports.

Neslee Canil Pinto’s picture

Status: Needs work » Needs review
FileSize
4.04 KB
453 bytes
KondratievaS’s picture

FileSize
70.34 KB

Tested patch from #53 and result is OK

OK

KondratievaS’s picture

Status: Needs review » Reviewed & tested by the community
lauriii’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/themes/claro/css/components/tabs.pcss.css
    --- a/core/themes/claro/css/layout/layout.css
    +++ b/core/themes/claro/css/layout/layout.css
    
    +++ b/core/themes/claro/css/layout/layout.css
    --- a/core/themes/claro/css/layout/layout.pcss.css
    +++ b/core/themes/claro/css/layout/layout.pcss.css
    

    Let's regenerate the layout.css 😇

  2. +++ b/core/themes/claro/css/layout/layout.pcss.css
    @@ -1,10 +1,18 @@
    +@media screen and (max-width: 38em) {
    

    We have generally preferred usage of min-width selectors on media queries.

sauravk’s picture

Assigned: Unassigned » sauravk
sauravk’s picture

Status: Needs work » Needs review
FileSize
4.13 KB
513 bytes
sauravk’s picture

Assigned: sauravk » Unassigned
shaktik’s picture

FileSize
78.57 KB

it looks good to me.

BhumikaVarshney’s picture

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

Hi,
The #59 patch is working for me.

lauriii’s picture

Status: Reviewed & tested by the community » Needs work
FileSize
12.24 KB

There's a regression on the secondary tabs focus effect:

sauravk’s picture

Assigned: Unassigned » sauravk
sauravk’s picture

Assigned: sauravk » Unassigned
Status: Needs work » Needs review
FileSize
4.26 KB
990 bytes
95.82 KB

Fixed secondary tabs focus effect.

KondratievaS’s picture

FileSize
105.84 KB

Tested patch from #64 in Chrome, FF, Safari, IE for mobile and desktop resolutions and result is OK

OK

KondratievaS’s picture

Status: Needs review » Reviewed & tested by the community

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.

xjm’s picture

lauriii’s picture

Title: Correct secondary tabs size » Implement secondary tabs based on the designs
Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
Issue tags: -Needs frontend framework manager review

Discussed with @ckrina about the secondary tabs designs and it seems like there are at least a couple of things that were clarified in the designs that need to be addressed here too:

  1. The spacing above the secondary tabs should be 0.75rem (space S)
  2. The font-size in secondary tabs should be 0.889rem (font-size S)
  3. The min-height of the secondary tabs should be 40px
sauravk’s picture

Assigned: Unassigned » sauravk
sauravk’s picture

Assigned: sauravk » Unassigned
Issue summary: View changes
Status: Needs work » Needs review
FileSize
5.29 KB
2.8 KB
187.96 KB

Only local images are allowed.

nitesh624’s picture

FileSize
38.05 KB
28.28 KB

patch https://www.drupal.org/files/issues/2020-05-07/3097651-71.patch fixes the css problem see the below screenshotscreenshot 1screenshot 2

atul4drupal’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs frontend framework manager review

#71 Looks good,addresses concerns from #69.

lauriii’s picture

This looks great! We're currently on a code freeze but I will get back to this once the freeze is over.

  • lauriii committed 2d166ac on 9.1.x
    Issue #3097651 by kishor_kolekar, sauravk, reinchek, Neslee Canil Pinto...

  • lauriii committed 1bd6d65 on 9.0.x
    Issue #3097651 by kishor_kolekar, sauravk, reinchek, Neslee Canil Pinto...

  • lauriii committed b414f71 on 8.9.x
    Issue #3097651 by kishor_kolekar, sauravk, reinchek, Neslee Canil Pinto...
lauriii’s picture

Version: 9.1.x-dev » 8.9.x-dev
Status: Reviewed & tested by the community » Fixed

I had to run yarn run lint:css --fix and yarn run build:css. Interdiff attached here.

Committed 2d166ac and pushed to 9.1.x, 9.0.x and 8.9.x. Thanks!

lauriii’s picture

FileSize
1.04 KB

Here's the missing interdiff

Status: Fixed » Closed (fixed)

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