Search code examples
htmlcsspolymerpaper-elementscore-elements

Float a paper-dropdown above other content


Here's my problem:

enter image description here

I have a paper-dialog with a input field and a dropdown. Here's the code (jade):

paper-action-dialog#createMatch(ng-heading="'Create Match' | translate", transition="core-transition-bottom", style="width: 600px")
  p
    | {{"Choose your match options" | translate}}
  p
    paper-input#matchNameInput(floatinglabel="",ng-label="'Match Name' | translate", required="", ng-error="'You must enter a match name.' | translate",style="padding: 0")
  p
    paper-dropdown-menu#gameModeInput(ng-label="'Game mode' | translate")
      paper-dropdown.dropdown
        core-menu.menu
          paper-item(ng-repeat="(id, name) in GameModeN" value="{{id}}") {{name}}
  paper-button(affirmative="") {{"Cancel" | translate}}
  paper-button.primary-btn(affirmative="", autofocus="") {{"Create" | translate}}

Here's the converted HTML if it burns your eyes too much:

<paper-action-dialog id="createMatch" heading="Create Match" transition="core-transition-bottom" style="width: 600px">
  <p>Choose your match options</p>
  <p>
    <paper-input id="matchNameInput" floatinglabel="" label="Match Name" required=""></paper-input>
  </p>
  <p>
    <paper-dropdown-menu id="gameModeInput" label="Game Mode">
      <paper-dropdown class="dropdown">
        <core-menu class="menu">
          <paper-item value="value">Item</paper-item>
        </core-menu>
      </paper-dropdown>
    </paper-dropdown-menu>
  </p>
  <paper-button affirmative="">Cancel</paper-button>
  <paper-button affirmative="" autofocus="" class="primary-btn">Create</paper-button>
</paper-action-dialog>

I've tried using position:absolute and nearly every combination of position types on the menu and its parents. Nothing seems to work. Perhaps this is because it's in a shadow dom? How can I get the menu to float over everything else?


Solution

  • The layered attribute should do this

      <paper-dropdown class="dropdown" layered="true">
        <core-menu class="menu">
          <paper-item value="value">Item</paper-item>
        </core-menu>
      </paper-dropdown>