Problem/Motivation

Admin toolbar has default CSS of

#toolbar-bar {
  z-index: 9999;
}

This value is absolutely inappropriate, as it is higher than the recommended z-index of modal windows.

Remove this style without any replacement, the id selector is harmful, and the core CSS already has a high enough z-index for ".toolbar-bar"

Also see Z-indexes in Drupal 8

Proposed resolution

Change the z-index to 502.

#toolbar-bar {
  z-index: 502;
}

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hudri created an issue. See original summary.

adriancid’s picture

@hudri thanks for reporting I will take a look soon, next time please consider to use the Issue Summary Template to report an issue.

adriancid’s picture

Assigned: Unassigned » adriancid
eme’s picture

Indeed, we should try a z-index of 502

  • adriancid committed 5a07bd6 on 8.x-1.x
    Issue #2913299 by hudri, adriancid, eme: CSS Z-Index of toolbar is...
adriancid’s picture

Issue summary: View changes
Status: Active » Needs review

I edit the issue description and commit the change it works fine in my side, just need more test I think to close here the issue.

adriancid’s picture

Assigned: adriancid » Unassigned
hudri’s picture

I'd recommend not to set the z-index at all, because it is already set by core toolbar, which is a dependency of Admin toolbar. IMHO there is no reason to override a sane default. DRY and KISS.

If there is a good reason to override it, please use a less specific selector (.whatever.classes) than an #ID: Frontend themes might need to make some small adjustments to the toolbar, e.g. because they have a fixed header or a fixed navigation themselves.

adriancid’s picture

Some problems that this can cause are like #2917441: Maximize button and 8.x-1.20

esod’s picture

@hudri, I unintentionally wrote a duplicate issue for this problem. See Maximize button and 8.x-1.20. When we noticed the bug with the Maximize button, I didn't know what I had on my hands except a bit of a mess.

The z-index change is already in the 8.x-1.x version of the module. I've removed the z-index for the 8.x-1.20 version of the module in my issue. I'll write the patch to remove the z-index from 8.x-1.x.

esod’s picture

Here's the patch to remove the z-index.

adriancid’s picture

@eme it seems that is better remove the z-index, what do you think about this?

Chi’s picture

Priority: Normal » Major
Issue summary: View changes
FileSize
89.84 KB

Wrong z-index value causes overlapping modal windows (Block UI, Views UI, etc).
Admin toolbar overapping

  • adriancid committed 2e31f1a on 8.x-1.x
    Issue #2913299 by esod, Chi, adriancid, hudri, eme: CSS Z-Index of...
adriancid’s picture

Status: Needs review » Fixed
michal.sec’s picture

Patch #13 will not fixed this problem, because is removing line z-index: 502;, but in current version is line z-index: 9999;.

Posting new fix.

adriancid’s picture

Hi @michal.sec the problem is fixed in the last commit in this issue, is 502 because we changed it before in #5 if you go the dev version you will see that it doesn't exists.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.