Problem/Motivation
AFAIK this hasn't been reported anywhere but there is a bug in the Admin Toolbar and its criteria of showing the "Home" / "Back to site" button, for which this doesn't work anymore on admin themed pages that don't start with a /admin/
segment in the URL.
I am pretty convinced this has been regressed after the changes introduced in the first release of core 8.4.x
and more specifically by the changes in #2542050: Toolbar implementation creates super annoying re-rendering..
Steps to reproduce:
- Install Drupal via 1 of the latest core versions
8.8.x
is fine for this bug. - Login as an admin and visit the front page or subsequently another page that doesn't have the admin theme to build the session storage with an item for
escapeAdminPath
. - Go to an admin page and see that the first item in the toolbar shows either "Home" or "Back to site" if not the front page.
- Go to an admin page that doesn't start with a
/admin/
segment eg./taxonomy/term/xxx/edit
or/user/xxx/edit
which are still pages that use the admin theme. See how these pages do not show the "Home" or "Back to site" button.
When executing these exact same steps on core <8.4.x
the above works correct.
Screenshots:
Origin:
The bug I believe originates from the added changes in core/themes/stable/css/toolbar/toolbar.module.css
:
/**
* Toolbar home button toggle.
*/
.toolbar .toolbar-bar .home-toolbar-tab {
display: none;
}
.path-admin .toolbar-bar .home-toolbar-tab {
display: block;
}
... where it was assumed that every admin themed page is identifiable with the .path-admin
class. However as it turns out these are not interchangeable, because an admin themed page can perfectly fine not start with an "/admin/" segment for which that class is the actual representative, and we now end up having pages like the user edit or the taxonomy edit pages that don't have this button anymore.
Proposed resolution
Either extend the CSS classes that show the button or use a different class that is a more exact 1 on 1 representative of an admin themed page. At first I thought to extend it with another 2 selectors including .path-user
and .path-taxonomy
but that wouldn't be reliable or even be correct, as only the edit form of taxonomy pages are using the admin theme, and the same applies for the user entity pages.
Remaining tasks
Agree on a fix, write a patch and add test coverage.
User interface changes
The original Toolbar behaviour in terms of displaying the "Home" or "Back to site" button.
API changes
None
Data model changes
None
Release notes snippet
None