Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The 'perspective tabs' (content/behavior) are hardcoded and cannot be adjusted to different themes.
The tabs don't seem to render well on Claro or Gin (Claro subtheme).
Steps to reproduce
Create a paragraph with a behavior plugin and check with Claro / Gin themes.
Proposed resolution
1. Rendering the tabs through the theme layer.
2. Altering the 'is-active' class so it applies to the 'tabs__link' inside the <li>
element, like the rest of Drupal.
Remaining tasks
Fix broken tests (if any).
Comment | File | Size | Author |
---|---|---|---|
#26 | 3199551_25-26-interdiff.txt | 1.42 KB | mathilde_dumond |
#26 | 3199551_26.patch | 3.41 KB | mathilde_dumond |
| |||
#25 | 3199551_23-25-interdiff.txt | 1.02 KB | mathilde_dumond |
#25 | 3199551_25_claro_behaviorTabs.patch | 3.39 KB | mathilde_dumond |
| |||
#23 | 3199551_23_claro_behaviorTabs.patch | 2.59 KB | mrinalini9 |
|
Issue fork paragraphs-3199551
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
nuezComment #3
nuezComment #5
nuezComment #6
nuez1. Added the 'is-active' class to the link instead of the
<li>
element- with all corresponding JS changes.2. Wrapped the tabs in a div, so the tabs can be visualised using display:flex (which is what Claro/Gin uses)
3. Put the tabs in a theme function. Although the tabs work with claro now, other teams might want to alter styling even further.
4. Added $.blur() because the tabs were 'hanging in' a ':focus' state causing wrong styling.
This is after the fix:
Comment #7
nuezNot sure if there's a better way, but also uploading the patch to include it in composer.
Comment #8
nuezComment #11
JeroenTThe desktop version looks great!
Tests seems to be failing because the tabs are no longer sticky at the top of the page.
Also the tabs are no longer shown on mobile screens:
Comment #12
JeroenTI took a bit of a different approach.
I removed the tab classes and created dedicated styling for this element.
The advantage of this approach is that every theme uses these styles as default.
Every theme that wants to improve these element, can override the styles.
Seven:
Gin (or Claro):
Comment #13
JeroenTComment #14
JeroenTComment #15
romina_ferrario CreditAttribution: romina_ferrario at MD Systems GmbH commentedStarted from the beginning and created new patch.
This is how claro looks like with this patch (based on the claro styleguide):
active and not active state:
hover:
focus:
NOTE:
- Seven looks different with this patch but it's not broken.
Seven now:
active and not active state:
hover:
Seven after add the patch:
active and not active state:
hover:
- The mobile view is broken now. I will continue to work on it and fix the mobile view.
Comment #16
romina_ferrario CreditAttribution: romina_ferrario at MD Systems GmbH commentedadded a new patch in which desktop and mobile design is fixed
Desktop view:
Mobile view:
Comment #17
JeroenTComment #18
romina_ferrario CreditAttribution: romina_ferrario at MD Systems GmbH commentedcreated a new patch because I found the classes on claro which includes all styling (for mobile and desktop). Also with this patch seven looks exactly the same as bevor.
Comment #19
Berdirwhy is this removed? isn't this for cases when there are no behaviors? make sure it only shows up when you add paragraph types that have behaviors.
Comment #20
romina_ferrario CreditAttribution: romina_ferrario at MD Systems GmbH commentedI'm not sure if this is originally written for that, but it's no longer needed. Also not to hide the tabs when there is no Behavior.
Comment #21
mathilde_dumond CreditAttribution: mathilde_dumond at MD Systems GmbH commentedwith the display: none rule added back-
Comment #22
BerdirPatch doesn't apply on 8.x-1.x-dev.
Comment #23
mrinalini9 CreditAttribution: mrinalini9 at Srijan | A Material+ Company for Drupal India Association commentedRerolled patch #21, please review it.
Comment #24
BerdirDiscussed, the none css breaks the display: flex through show(). lets change paragraphs-tabs to paragraphs-hide for the none selector and remove/add that class in our JS.
Comment #25
mathilde_dumond CreditAttribution: mathilde_dumond at MD Systems GmbH commentedComment #26
mathilde_dumond CreditAttribution: mathilde_dumond at MD Systems GmbH commentednow with the class hide applied from the start
Comment #28
BerdirCommitted.