Problem/Motivation
Toolbar module has styling intended to give a consistent appearance, no matter which theme is active, so that it appears the same on the website's front end and admin pages.
However, the CSS rules from custom themes can easily leak into the toolbar, breaking the toolbar appearance in unexpected ways.
Specific problems/workarounds encountered so far:
- Bartik uses border-bottom to underline links, instead of the usual text-decoration. This has the side effect of adding a border to each toolbar link, so Bartik has extra toolbar CSS to avoid this.
- Umami's hover style colours leaked into the toolbar, causing low-contrast text. Details in #2941647: Link hover styles unintentionally applied to administration toolbar.
- Toolbar text uses a sans-serif font, but Umami's serif font styles leaked into the toolbar. Details in comment #6 and #9 here, and also comments #40-43 in #2983568-40: Audit and improve focus styles across the Umami theme for logged out users. Umami has encountered this regression several times.
Since two core themes have clashed with toolbar stlying already, it's a safe bet that other themes will encounter problems like these too. The admin-UI initiative has started their theme refresh, so that seems a likely place where this will crop up again.
It would be great if theme maintainers didn't have to worry about this happening so much. Distribution (and profile) maintainers in particular will want to avoid breaking toolbar styles, to remain attractive to users (e.g. many have demo videos/sandboxes, or form the basis of a product).
Proposed resolution
Can we make the CSS in Toolbar module more resistant to problems like this?
Remaining tasks
TBD.
User interface changes
None.
API changes
None.
Data model changes
None.
Original report
This issue was originally about fixing the serif-font problem that Umami encountered. The issue was re-scoped once we realized it was a more general problem that several core themes have run into.
Comments
Comment #2
jogordon commentedWorking on this at #uoe-d8-contribution
Comment #3
jogordon commentedI'm attaching a patch that should fix the issue with the 'edit' button on the toolbar showing in a serif font.
We are first timers, so please be nice. :-)
Comment #4
jogordon commentedComment #5
eli-tThanks for your help @jogordon!
I'm not sure we have the right approach here though - we seem to be resetting the font originally set in Stable in the Umami theme. It would be much better to not override it. Umami theme should not have to know what Stable originally set it too.
Also please check https://www.drupal.org/docs/develop/standards/css/css-formatting-guidelines - we have to comply with these for all css.
Comment #6
mairi commented@Eli-T I'm helping @jogordon with this at a contribution day but I'm not able to reproduce the problem in 8.7.x-dev with the latest code. I see the problem with an 8.6.2 installation, but with 8.7.x-dev the Edit link shows in a sans serif font. Could this have been fixed as a side effect of something else? Screenshot attached from 8.7.x-dev instance:

Comment #7
eli-t@mairi that's really interesting! Potentially this could have been fixed somewhere else. It would be useful to pinpoint where before closing the issue.
Comment #8
eli-tQuick spin on simplytest.me shows this appears to be fixed in both 8.6.x and 8.7.x
Comment #9
andrewmacpherson commentedI remember seeing this problem much more recently than when I filed it in July. I think I probably saw it when reviewing #2983568: Audit and improve focus styles across the Umami theme for logged out users.
Today I replicated it with the latest code 8,7.x code (commit 4f02a38)...
It's the same in Chrome 71 on Linux, all fine.
It's the same problem in Chrome 71 on Linux.
Comment #10
andrewmacpherson commentedPropose we postpone this until after #2983568: Audit and improve focus styles across the Umami theme for logged out users has been committed.
Comment #11
andrewmacpherson commentedIf Umami styles keep leaking into the toolbar, it's a safe bet other custom themes run into this too. So perhaps this needs more robust CSS in toolbar module itself?
Comment #12
andrewmacpherson commentedThis issue can be active again, since #2983568: Audit and improve focus styles across the Umami theme for logged out users is fixed.
Comment #13
andrewmacpherson commentedComment #14
markconroy commentedI'm going to mark this issue as closed, we fixed it as part of #2983568: Audit and improve focus styles across the Umami theme for logged out users and gave credit in that issue.
Comment #15
andrewmacpherson commentedUmami keeps running into the problem of styles leaking into the toolbar - both the serif-font problem here, and the colours in #2941647: Link hover styles unintentionally applied to administration toolbar.
So I think it's worth re-scoping this, to see whether the toolbar module CSS can be made more resilient?
Umami isn't the only theme affected - Bartik also has a toolbar styling leak. It uses border-bottom instead of text-decoration for underlining links, so it also has an override to prevent the both toolbar levels getting extra border.
If 2 core themes need overrides to repair the toolbar, we can expect that other themes run into this too. Perhaps the admin-UI initiative's new theme will encounter this too? It would be great if themers didn't have to worry about this (distro/profile maintainers especially).
Comment #16
andrewmacpherson commentedComment #24
pameeela commentedThis happens on pretty much all of our sites! Haven't dug into it at all but found this issue when I eventually decided to try to do something about it. Much of the time, it's only a slight change to the font but in some cases it's quite obvious and very annoying.
If anyone has tips or tricks to avoid it please share :)
Comment #25
longwaveThe off-canvas settings tray now uses
all: revert;to avoid styles leaking into it: #3291797: Refactor Drupal 10 settings tray / off-canvas to use modern CSSMaybe we can use a similar technique in the toolbar?
Comment #29
quietone commentedThe Toolbar Module was approved for removal in #3476882: [Policy] Move Toolbar module to contrib.
This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
The deprecation work is in #3484850: [meta] Tasks to deprecate Toolbar module and the removal work in #3488828: [meta] Tasks to remove Toolbar module.
Toolbar will be moved to a contributed project before Drupal 12.0.0 is released.
Comment #30
quietone commentedToolbar has moved to contrib