Originally submitted on Github
Problem/Motivation
Recent interviews and research exposed pain points around Drupal's admin experience of looking and feeling dated.
Proposed resolution
Implement new horizontal tabs styles to create a favourable first impression of Drupal for evaluators and a better user experience for site authors. No functional differences.
Specification
Quick overview
This image is just a quick overview for Horizontal tabs specs. Please use the Figma link to full specification as the main resource for specks.

Color palette
Full specification
FIGMA: https://www.figma.com/file/OqWgzAluHtsOd5uwm1lubFeH/Design-system?node-i...
This link is anchored to the board with the full specification. As an anonymous user you can see the design, but to actually be able to pick colours and sizes please login to Figma.
Remaining tasks
- Accessibility review
- RTL review (Right to left)
User interface changes
All tabs styles will be changed, no functional differences.
Test Pages
- /admin/content
- /node/add/article
- /admin/content/files
- /admin/content/comment
- /admin/structure/types/manage/article/fields
| Comment | File | Size | Author |
|---|---|---|---|
| #67 | Claro-tabs-ie11-actual.png | 9.28 KB | huzooka |
| #67 | Claro-tabs-ie11-expected.png | 6.44 KB | huzooka |
| #66 | interdiff.txt | 1.19 KB | lauriii |
| #66 | claro-tabs-3023306-66.patch | 35.7 KB | lauriii |
| #64 | Claro-Edge-tabs.png | 142.39 KB | huzooka |
Comments
Comment #2
saschaeggiUpdated link to final specs
Comment #3
huzookaFigma says "not finished".
Comment #4
saschaeggiAdded related ticket of content header with specs
Comment #5
ckrinaComment #6
shaalWork in progress...
On
/admin/structure/types/manage/article/displaypage, in mobile, the secondary hamburger menu does not open/close.Desktop preview:

Mobile preview:

Comment #7
ckrinaI haven't tested this locally, but from your screenshot I'd say background colours need a bit of work: in desktop, primary tabs shouldn't have background colour, while in mobile the background shouldn't be the same as the header (although it's really close). In mobile we're using the header background in a 40% opacity, but it's over a white background (which makes it lighter than the background itself). So to make this possible I'd suggest adding the white to the
.tabselement and the--color-whitesmoke-o-40to the.tabs__tabitself.Thanks for working on this @shaal! It's great to see this moving forward :)
Comment #8
lauriiiMade some more progress on this one. Could use another round of review 🙂
Comment #9
lauriiiThis implements the border radius according to the style guide.
Comment #10
ckrinaI've changed the active/focus indicator to use the
:beforepseudo-element instead of the border to avoid ugly corners and to avoid conflict with the focus (in case you want to implement it with the border to preserve the border-radius from the designs). I've prepared a patch because it was easier than to explain it.The focus styles still need to be work on, I haven't had time for it, sorry.
Also, if we’re moving the tabs to the top depending if it’s active and we rely on styles based on its html position (i.e. :last-child), it won’t work because they may end up at the top. I would suggest to start using classes added with JS if we're going to rely on that.
I’d also suggest to not implement this “moving” behaviour in the Secondary tabs: if you access into a page and the “Option 1” is in the top and when you navigate to the next page it's in the third position it’ll confuse people. It makes sense in the Primary tab because they behave like a collapsible menu, though.
Comment #11
ckrinaComment #12
huzookaTest module that may help development: https://github.com/zolhorvath/tab
Comment #13
finnsky commentedSeems #10 patch is broken. it fully removes menu-local-tasks.html.twig without adding new one
also {{ source('/themes/claro/images/src/hamburger-menu.svg') }} in templates/navigation/menu-local-task.html.twig
broken in case of location theme in themes/contrib/claro
Comment #14
finnsky commentedComment #15
finnsky commentedi agree with @ckrina about that order for secondary tabs. also it gives jumping on tab navigation.
Comment #16
finnsky commentedComment #17
finnsky commentedComment #18
finnsky commentedAccording to design tabs--primary margin top should be removed and belongs to heading

Comment #19
finnsky commentedRemoved margins in tabs--primary.
Comment #20
Kami Amiga commented= var(--font-size-base)
= var(--font-size-s)
convert into rem here too ?
= var(--base-border-radius)
= var(--space-xs) var(--space-m)
Comment #21
huzookaThe current implementation is broken if there are more tabs on the page that can fit into the viewport width, see the attached screenshot.
I strongly suggest to keep the behavior of tabs in seven:
nav-tabs.es6.jsand it's compiled filenav-tabs.js, or(edit):
Patch contains coding standard errors.
Comment #22
imalabyaAdded a patch to fix the issues raised in #20 and CS issues at #21
There is a mixed usage of both rem and px. Shouldn't we follow either one throughout the project for consistency?
Comment #23
huzooka@imalabya, I can't remember where, but we agreed that we prefer
rem.Comment #24
huzookaI still see
pxunits in the patch, and the main issue described in #21 (unreachable tabs) isn't solved, so NW.Comment #25
Kami Amiga commentedStarted to replace px units by rem (following these guidelines : https://www.drupal.org/docs/8/modules/claro/claro-css-coding-standards). About the unreachable tabs, I'm not sure I'll be able to fix this ^^'
Comment #26
Kami Amiga commentedJust updated the values to use more variables and more rem units. I don't know what to do to solve the problem of unreachable tabs, sorry :/ What is the intended behaviour by the way ? I couldn't find examples of it in the Figma.
Finally, I also had troubles applying the previous patch because of changes in variables.css since then, so I don't know how to generate the interdiff file...
Comment #27
finnsky commented@Kami Amiga, could you please provide interdiff?
Comment #28
dslobodyanik commentedComment #29
dslobodyanik commentedI took a stab at fixing the invisible tabs issue.
As @lauriii suggested, this patch makes the tabs switch to the collapsed small screen mode whenever there's not enough space on screen for them in horizontal mode.
Comment #30
dslobodyanik commentedComment #34
lauriiiRerolled the most recent patch.
Comment #35
ckrinaComment #36
brightboldI’m testing out this patch and while it's looking good on vertical and horizontal tabs as evidenced on a content edit page, it seems to be wreaking havoc with Views.
The biggest issue is that the Views tabs aren’t marked with the

.is-horizontalclass, so all non-active tabs are set todisplay: none, the flex-direction is column instead of row, and the active tab flex-grows to 100% width. If you remove the css hiding non active tabs, it looks like this:What's the best way to approach this with Claro? Do we want to:
.views-display-topmarkup to add theis-horizontalclass (and if so, then maybe that request needs to go through core?)(One additional concern that needs to be addressed for views tabs is the bullet before the "Add" tab, but that problem predates this patch so I'm not sure if it is part of this issue or should be handled separately.)
Comment #37
lauriiiGood catch @BrightBold! I opened #3051605: Create new template for rendering Views UI tabs. in the core queue but we should work around this in Claro before that gets fixed.
Comment #38
lauriiiCustomized the views tabs markup so that they could be themed separately. I also copied all tabs CSS rules from Views UI and rewrote the selectors to work with the new markup.
Comment #39
lauriiiComment #40
bnjmnmUnless specified otherwise, anything reported was found in OSX Safari, Firefox, and Chrome + IE11 on Windows 8
function()syntax in nav-tabs.es6.js that should be converted to arrow function syntaxInitially found at admin/structure/types/manage/article/fields but is not specific to the page: The contents of primary & secondary tabs are not vertically centered(it looks like this was due to something specific to my local env)In the Figma specs, primary/secondary tabs have transparent backgrounds, regardless of state. Currently, the background is different on hover and when links have the(it looks like this was due to something specific to my local env).is-activeclassFound at /admin/content: the stripe of color indicating the active tab is not flush with the bottom of its container. It looks like this is due to bottom padding on.tabs awhich limits the height of the stripe provided by its:beforeselector.(it looks like this was due to something specific to my local env)
This also cuts off the background color of active tabs on the right side, but that should not be an issue once we've taken care the background color behavior mentioned in the previous item in this list.
I'm still in the process of reviewing this, so an additional comment with more items may appear shortly. I wanted to provide the above information sooner than later so others have an opportunity to work on these items while I'm nit-finding in multiple browsers.
Comment #41
bnjmnmIE11 Findings
/tabs, provided by the helper module mentioned earlier in this issue. The active secondary tab does not seem retain its width, and the tabs do not collapse despite exceeding the viewport widthComment #42
bnjmnmSwitching to NW for the issues identified in #40 and #41
A review of the code itself is still needed (40-41's issues were discovered from cross browser issues), but that may be simpler to do if the above issues are addressed.
Comment #43
lauriiiWorking on this
Comment #44
lauriiiI couldn't reproduce #41.3 but other than that this should address all feedback.
Opened follow-up for a pretty significant accessibility issue on the current mobile styles: #3053457: Flex order breaks tabbing order on tabs . I think this can be fixed in a follow-up because mobile tabs keyboard navigation in Seven seems to be pretty broken as well.
Comment #45
lauriiiAdded styles for tabs that are both focused and hovered.
Comment #46
bnjmnmI'll look further into #41.3 and open a followup if needed, but no need to do anything more here as it's out of scope for this issue.
This is arguably very unlikely to occur, but if array_search returns false, the unset() call that follows it will result in an error.
This is expecting the exact string
class="tabs secondary"which could potentially be changed by a contrib module. Perhaps this could use something like Symfony DomCrawler to alter the class attribute directly?For text-overflow to work, this element would need to be set to
overflow: hidden;, but in this case it still won't work as the text is all enclosed in an anchor tag set todisplay: flex;and text-overflow won't apply to elements displayed as flex.Is this rule necessary, since this will be the only child element of .tabs__tab?
This rule can be removed, the design has the primary and secondary tabs set to the same font size, so the styles applied to .tabs__tab are sufficient.
/* LTR */
If there's a way to do it clearly, it could be helpful to add a @todo referencing https://www.drupal.org/node/3051605, as many of these rules may be unnecessary or will change after that issue is completed.
Is this necessary since its only calling another function? (I'm guessing this had additional logic at some point)
Should this get a @todo to https://www.drupal.org/node/3051605 as it may be impacted/unnecessary once that is completed?
Comment #47
zrpnrThe related issue https://www.drupal.org/project/claro/issues/3053457
depends on the patch in #45.
Based on the conversation in Drupal slack the problem with tabbing order has to do with the element source order but the active tab on mobile is visually set with flexbox.
This new patch adds in a method for changing the source order when the tab menu is collapsed and restoring its order for the horizontal display.
Tested on Chrome.
Comment #48
lauriiiThank you @zrpnr! I closed the follow-up.
#46.8 This is needed for the mobile styles where the link and toggle are placed side by side.
Besides that, all feedback from #46 has been addressed.
Comment #49
huzookaReviewing
Comment #50
huzookaInstead of hard-coding a specific
heightwe should define amin-height.Active tab border (narrow screens) does not follow design.
The almost-invisible-background defined by the design is missing.
Missing trailing semicolon.
Suggested narrow solution:
Instead of flexing the active tab and the toggler I suggest positioning the toggler as absolute (top, right, bottom: 0) and placeholding it's area with a right margin applied on the active tab.
Comment #51
lauriiiIt seems like removing the
white-space: nowraphas broken the JavaScript that switches between desktop and mobile layouts. We probably should add that back so we don't have to worry about issues related to tab height.I asked for feedback from the design team regarding the background. The explanation is conflicting. The demo contains a white layer between the header and the tabs. This isn't described anywhere so I'm not sure if it was done on a purpose.
I also noticed a problem with secondary tabs. It seems like the secondary tabs are not switched to the mobile layout on a wide screen even if the tabs overflow the screen.
Comment #52
zrpnrI think I addressed @huzooka's feedback in #51, made the tabs stretch height, I kept flexbox instead of absolute positioning but the trigger also stretches now too like your suggested solution looks.
1. Changed to min-height to allow for text wrap
2. moved the active tab blue to the li so that it overlaps like in the figma comp, I made some other small adjustments to hover, focus and active styles.
3. Depending on what the design team says @laurii we can change this- but for now I made a new color that is the "visual" gray from the design, just a hex value of #fafbfd
4. I didn't see this in css/src/components/views-ui.css
The secondary tabs were missing a class and a data attr, they should now collapse based on their parent width.
Comment #53
ckrinaAfter a conversation with @lauriii and important accessibility suggestions by @andrewmacpherson, I've changed a bit the designs for tabs. Specifically the hover, focus, active+focus, hover+focus styles.
I've also added an example of how a tab with long text should behave on mobile tabs: instead of hiding text, it should jump into a second line.
Comment #54
bnjmnmComment #55
bnjmnmComment #56
lauriiiRerolled the most recent patch
Comment #57
lauriiiThis implements the design changes. There's one difference in the current implementation compared to the designs, which is that the grey border is extended to the left so that the grey focus ring doesn't look like it's floating.
This is how the design looks like without this change:

And this is what we ended up with:

Comment #58
lauriiiCristina approved this in Slack so this is ready for a review 🙂
Comment #59
zrpnrThis addresses the redesign of the tabs very well, I am a little confused by the figma design which shows some overlap in the hover state.
I think this looks cleaner as you've done it, and if Cristina already approved too then it should be good.
I noticed a few details:
In figma the focused mobile state has --color-davysgrey #222330, but `.is-horizontal .tabs__link` should be --color-text
in Figma this is #0036B1, absolutezero-hover
The svg is not quite centered vertically, could add:
```css
display:flex;
align-items:center;
justify-content:center;
```
space before semicolon
non focus horizontal tabs__link also need top border-radius
I have attached a patch with these changes already applied, everything else looked ready to be RTBC to me.
Comment #60
lauriiiThere was a mistake in the way the negative margins were calculated for secondary tabs. Attached fix for this. For me this looks good and I think this is RTBC based on #59.
Comment #61
lauriii@huzooka pointed out a missing semicolon on Slack. Uploading a new patch to fix that.
Comment #62
lauriii@huzooka pointed out also that there's some debugging code in the .theme file. Removed that from the patch.
Comment #63
huzookaIn review.
Comment #64
huzookaComment #65
huzookaPotential fix of focusable SVG: https://github.com/PolymerElements/iron-iconset-svg/issues/46#issuecomme...
Comment #66
lauriiiI'm not sure what #64.1 is referring to. Coudl you post more specific instructions to reproduce the problem?
This patch fixes #64.2-4.
Comment #67
huzookaSteps to reproduce issue #64.1:
/admin/structure/types/manage/articlewith IE11.You should see this:
But now you will have this:
Comment #68
lauriiiI think this is solved by #66 as well.
Comment #69
huzookaIn review...
Comment #70
huzookaRTBC!
Comment #72
lauriiiThank you everyone, this is a huge step forward! 🚀