Back to site button gone on several admin pages

Created on 21 April 2020, almost 5 years ago
Updated 16 August 2024, 6 months ago

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:

  1. Install Drupal via 1 of the latest core versions 8.8.x is fine for this bug.
  2. 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.
  3. 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.
  4. 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

Convert to MR
Respond to #41
Update proposed resolution

User interface changes

Add before and after screenshot here

API changes

None

Data model changes

None

Release notes snippet

None

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Toolbar 

Last updated 14 days ago

  • Maintained by
  • 🇫🇷France @nod_
Created by

🇧🇪Belgium baikho Antwerp, BE

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024