This issue is related to #935738: z-index conflict between block context menu & overlay.

The z-index of the contextual links are set to 900. The toolbar has a z-index value of 600. This means that the contextual link gear wheel icon appears on top of the toolbar and shortcut bar. It does this for all contextual links I can find. There was one time I couldn't get it to break, but I can't recreate that anymore.

To recreate this issue, create a node that takes up enough space to cover the entire height of the page. Hover over the node to make the gear wheel appear, then scroll up. I would expect it to disappear when it reaches the toolbar, but it appears on top.

I suggest we be consistent with z-index extremes. Setting something to 900 is okay, but consider incrementing the various Drupal core elements by 5 so that they overlap the way we want them to? (ie. contextual links = 900, overlay = 905, toolbars = 910, etc).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

danillonunes’s picture

Some work with git grep gives me the following result about z-index usage on Drupal 7 (excluding jQuery UI styles):

modules/block/block.css               a.block-demo-backlink,
modules/block/block.css               a.block-demo-backlink:link,
modules/block/block.css               a.block-demo-backlink:visited {
modules/block/block.css                 z-index: 499;
modules/block/block.css               }
--                                    
modules/contextual/contextual.css     div.contextual-links-wrapper {
modules/contextual/contextual.css       z-index: 999;
modules/contextual/contextual.css     }
modules/contextual/contextual.css     div.contextual-links-active a.contextual-links-trigger {
modules/contextual/contextual.css       z-index: 1;
modules/contextual/contextual.css     }
--                                    
modules/overlay/overlay-child.css     #overlay-titlebar {
modules/overlay/overlay-child.css       z-index: 100;
modules/overlay/overlay-child.css     }
--                                    
modules/overlay/overlay-parent.css    #overlay-container,
modules/overlay/overlay-parent.css    .overlay-modal-background,
modules/overlay/overlay-parent.css    .overlay-element {
modules/overlay/overlay-parent.css      z-index: 500;
modules/overlay/overlay-parent.css    }
modules/overlay/overlay-parent.css    .overlay-element {
modules/overlay/overlay-parent.css      z-index: 501;
modules/overlay/overlay-parent.css    }
modules/overlay/overlay-parent.css    html.overlay-open .displace-top,
modules/overlay/overlay-parent.css    html.overlay-open .displace-bottom {
modules/overlay/overlay-parent.css      z-index: 600;
modules/overlay/overlay-parent.css    }
--                                    
modules/simpletest/simpletest.css     a.simpletest-collapse:focus,
modules/simpletest/simpletest.css     a.simpletest-collapse:hover {
modules/simpletest/simpletest.css       z-index: 1000;
modules/simpletest/simpletest.css     }
--                                    
modules/system/system.base.css        #autocomplete {
modules/system/system.base.css          z-index: 100;
modules/system/system.base.css        }
--                                    
modules/toolbar/toolbar.css           #toolbar {
modules/toolbar/toolbar.css             z-index: 600;
modules/toolbar/toolbar.css           }
--                                    
themes/bartik/css/style.css           #skip-link {
themes/bartik/css/style.css             z-index: 50;
themes/bartik/css/style.css           }
--                                    
themes/garland/color/preview.css      #preview #gradient-0 {
themes/garland/color/preview.css        z-index: 2;
themes/garland/color/preview.css      }
themes/garland/color/preview.css      #preview #text {
themes/garland/color/preview.css        z-index: 4;
themes/garland/color/preview.css      }
themes/garland/color/preview.css      #preview #img {
themes/garland/color/preview.css        z-index: 3;
themes/garland/color/preview.css      }
--                                    
themes/garland/style-rtl.css          #wrapper #container .breadcrumb {
themes/garland/style-rtl.css            z-index: 3;
themes/garland/style-rtl.css          }
--                                    
themes/garland/style.css              #skip-link {
themes/garland/style.css                z-index: 1000;
themes/garland/style.css              }
themes/garland/style.css              #branding,
themes/garland/style.css              #branding a:link,
themes/garland/style.css              #branding a:visited {
themes/garland/style.css                z-index: 2;
themes/garland/style.css              }
themes/garland/style.css              #wrapper #container .sidebar {
themes/garland/style.css                z-index: 2;
themes/garland/style.css              }
themes/garland/style.css              #wrapper #container .breadcrumb {
themes/garland/style.css                z-index: 3;
themes/garland/style.css              }
themes/garland/style.css              ul.main-menu {
themes/garland/style.css                z-index: 4;
themes/garland/style.css              }
themes/garland/style.css              ul.secondary-menu {
themes/garland/style.css                z-index: 4;
themes/garland/style.css              }
--                                    
themes/seven/style.css                #skip-link {
themes/seven/style.css                  z-index: 50;
themes/seven/style.css                }
themes/seven/style.css                .overlay #branding div.breadcrumb {
themes/seven/style.css                  z-index: 10;
themes/seven/style.css                }
Anonymous’s picture

Version: 7.0 » 7.14

Same here with the latest version (Drupal 7.14), here are the relevant CSS rules.

contextual.css:20 defines the following rule:
div.contextual-links-wrapper {z-index: 999;}
(other rules removed for brevity)

overlay-parent.css:24 defines the following rule:
.overlay-element {z-index: 501;}
(again, shortened for brevity)

And here is my workaround - I just added these rules into one of my own theme's CSS files:
/* OVERRIDES FOR OVERLAY Z-INDEX VALUES */
#overlay-container,
.overlay-modal-background,
.overlay-element {
z-index: 2500;
}
.overlay-element {
z-index: 2501;
}
html.overlay-open .displace-top,
html.overlay-open .displace-bottom {
z-index: 2600;
}
/* also added this so you can see the admin menu bar at the top while an overlay is open */
#toolbar {
z-index: 2600;
}

Wim Leers’s picture

Version: 7.14 » 7.24
Issue summary: View changes
Status: Active » Needs review
Issue tags: +Spark, +sprint
FileSize
492 bytes

This is not a problem in D8 anymore. It's still a problem in D7, sadly.

The fix is simple. Overlay's z-indexes are 500, 501 and 600. Toolbar's z-index is 600. Contextual links' is 999. Obviously that's why it's sitting on top of the toolbar.

So, changing Contextual links' to 450 fixes the problem.

Wim Leers’s picture

Note that this causes bug reports in contrib projects.

Wim Leers’s picture

Screenshots showing the fix:


mimes’s picture

This patch works, as tested in Firefox 25.0 and Chromium 28.0.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the review, mimes!

Marking RTBC since you confirmed that this fixes the problem.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 3: contextual_z_index-1102156-3.patch, failed testing.

droplet’s picture

Version: 7.24 » 7.x-dev

Contextual links are used everywhere and contribute modules. Toolbar is a CORE module usually only do single task and admin only. I would say to adjust the value in toolbar if it's possible.

stpaultim’s picture

Fixed the patch.

stpaultim’s picture

Status: Needs work » Needs review
lcampanis’s picture

Somewhat related, I created a D7 backport of the contextual links in D8. Hope it helps :)

https://www.drupal.org/node/1914966

RainbowArray’s picture

Status: Needs review » Reviewed & tested by the community

While #9 suggested changing the z-index of the toolbar rather than the contextual links, the issue linked to in #4 shows that contextual links need to have their z-index lowered below the overlay as well as below the toolbar. It's certainly possible this could have an impact on themes and modules that have been working around this bug: it's equally true that this patch will fix a lot of head-scratching errors for those who haven't worked around this bug.

Given that there's already been testing that shows this works, and the latest patch is green, I'd suggest we move this back to RTBC.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 10: contextual_z_index-1102156-10.patch, failed testing.

Status: Needs work » Needs review
David_Rothstein’s picture

Seems like this needs a bit more discussion. The risk of arbitrarily decreasing the contextual links z-index is that now they could start appearing underneath page elements that they aren't supposed to, which I think is arguably a worse bug...

vikashsoni’s picture

FileSize
6.41 KB

@davidneedham there is no issue related to z-index available checked on same version for reference sharing screenshot ....