paper-menu-button icon indicating copy to clipboard operation
paper-menu-button copied to clipboard

paper-menu doesn't display on foreground

Open Zippersk opened this issue 10 years ago • 15 comments
trafficstars

I have this problem:

weird

When I visit page the paper-menu displays correctly but when i scroll down and back to top, the paper-menu is behind the div (with id nav). I tried to play with z-index and positons but nothing worked.

CSS:

paper-scroll-header-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color:  #eee;
}

paper-toolbar {
  /* custom toolbar height */
  height: 100px;
  background-color: #6a1b9a;
  overflow: visible;
}
#nav {
  background-color: #6a1b9a;
}

HTML:

<paper-scroll-header-panel condenses keep-condensed-header header-height="100" condensed-header-height="50">

  <paper-toolbar>

   <h1>Some text</h1>
    <div class="flex"></div>
    <paper-menu-button>
      <paper-icon-button icon="menu" class="dropdown-trigger"></paper-icon-button>
      <paper-menu class="dropdown-content">
        <paper-item>Share</paper-item>
        <paper-item>Settings</paper-item>
        <paper-item>Help</paper-item>
      </paper-menu>
    </paper-menu-button>

   <div id="nav" class="flex bottom fit">
            <paper-tabs noink  >
              <paper-tab >Tab1</paper-tab>         
              <paper-tab >Tab2</paper-tab>
              <paper-tab >Tab3</paper-tab>
              <paper-tab >Tab4</paper-tab>
            </paper-tabs>
  </div>

  </paper-toolbar>

  <div class="content">
    <sample-content size="100"></sample-content>
  </div>

</paper-scroll-header-panel>

If you want to play around with code... (I don't know how to import polymer to jsbin or codepin. It says something about no third party using.)

Zippersk avatar Aug 02 '15 10:08 Zippersk

Thanks for the thorough report! I will take a look.

cdata avatar Aug 03 '15 13:08 cdata

I may have run into a similar menu overlay problem here, and @ebidel recommended I file a bug report. Here is another example, but demonstrated in slightly different manner (this time with iron-list). The SO issue report, and jsbin are noted below for your reference.

SO issue: http://stackoverflow.com/questions/31884654/paper-menu-buttons-dropdown-paper-menu-not-overlaying-other-iron-list-items

jsbin: http://jsbin.com/kuyovuh/1/edit?html,output

Sinjins avatar Aug 11 '15 21:08 Sinjins

@cdata Added an update to SO issue included above. Please note that jsbin on mobile device (Chrome 44 for Android) does not display dropdown menu at all.

Sinjins avatar Aug 21 '15 22:08 Sinjins

/cc @valdrinkoshi this is relevant to the overlay "final solution"

cdata avatar Jan 27 '16 22:01 cdata

@cdata @valdrinkoshi any movement on this? Even a workaround is proving troublesome

dwalters18 avatar Mar 21 '16 20:03 dwalters18

Hi @realiztiK, the issue is caused by how stacking context works. If you insert an overlay within an element that creates a new stacking context, it will be "trapped" in it (see this simplified example http://jsbin.com/lemufe/4/edit?html,output). paper-menu contains an iron-dropdown, which implements iron-overlay-behavior. It tries to be on top of everything by setting a high enough z-index, but its parent makes this impossible by creating a new stacking context. We're currently working on overlays 2.0 to overcome this issue :+1:

valdrinkoshi avatar Mar 21 '16 20:03 valdrinkoshi

Any idea whether the dropdown not appearing at all is the same issue or an unrelated one? I am seeing that behavior (paper-menu-button in an iron-list does not show the menu at all, but works fine with dom-repeat instead) on Chrome 48 on desktop but am unsure whether I should file a separate bug for it.

Caffeinix avatar Mar 25 '16 05:03 Caffeinix

Hi @Caffeinix, it might be related, a jsbin showing the issue would be helpful :smile:

valdrinkoshi avatar Mar 26 '16 00:03 valdrinkoshi

@valdrinkoshi: here you go: https://jsbin.com/qofemayowu/edit?html,output

Caffeinix avatar Mar 29 '16 00:03 Caffeinix

Thanks @Caffeinix! Yes, this is related. Each element of the iron-list has will-change and transform css properties setup, which create a new stacking context, which traps the paper-menu-button (and its iron-dropdown) within it.

valdrinkoshi avatar Mar 29 '16 01:03 valdrinkoshi

+1 any update on this one?

NicolasRannou avatar Jun 09 '16 14:06 NicolasRannou

+1 a simple example with the similar problem => http://jsbin.com/qinebiwiyo/edit?html,console,output

RoXuS avatar Jul 07 '16 13:07 RoXuS

+1 still waiting for a fix for this critical issue, it seems

Sinjins avatar Jul 20 '16 20:07 Sinjins

I suggest using https://github.com/PolymerElements/iron-overlay-behavior/pull/155

Until the PR is approved, you can access it by adding the following to your bower.json "iron-overlay-behavior": "PolymerElements/iron-overlay-behavior#stacking-context"

This branch has no conflicts with master.

dwalters18 avatar Jul 20 '16 20:07 dwalters18

Hi everyone, any solution for this? I'm working with an old polymer version, and I have this issue. Thanks in advance! Best regards!

rogeliotrejo13 avatar Oct 02 '20 03:10 rogeliotrejo13