I want to put a sub-element (child) inside an app-header-layout
. The sub-element contains a paper-dialog modal
. When I open the modal I expect to see the dialog box appear in front of the backdrop. Instead, the dialog appears behind the backdrop.
How do I get the modal dialog to appear in front of the backdrop? Or is this perhaps a newly discovered bug in the app-drawer-layout
or app-header-layout
elements?
Here is the plunk. ... http://plnkr.co/edit/ZjPHGqkt8vvDbFdF4CNn?p=preview
index.html<!DOCTYPE html>
<html lang="en">
<head>
<link rel="import" href="x-app.html">
</head>
<body>
<x-app></x-app>
</body>
</html>
x-app.html
<link href="content-el.html" rel="import">
<base href="https://polygit.org/components/">
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>
<link href="polymer/polymer.html" rel="import">
<link href="app-layout/app-drawer/app-drawer.html" rel="import">
<link href="app-layout/app-drawer-layout/app-drawer-layout.html" rel="import">
<link href="app-layout/app-header-layout/app-header-layout.html" rel="import">
<link href="app-layout/app-header/app-header.html" rel="import">
<link href="app-layout/app-toolbar/app-toolbar.html" rel="import">
<link href="iron-icon/iron-icon.html" rel="import">
<link href="iron-icons/iron-icons.html" rel="import">
<link href="paper-icon-button/paper-icon-button.html" rel="import">
<dom-module id="x-app">
<template>
<style></style>
<app-drawer-layout>
<app-drawer>
drawer-content
</app-drawer>
<app-header-layout>
<app-header>
<app-toolbar>
<paper-icon-button icon="menu" drawer-toggle></paper-icon-button>
<div main-title>MyNewApp</div>
</app-toolbar>
</app-header>
<content-el></content-el>
</app-header-layout>
</app-drawer-layout>
</template>
<script>
(function(){
Polymer({
is: 'x-app',
properties: {},
});
})();
</script>
</dom-module>
content-el.html
<base href="https://polygit.org/components/">
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>
<link href="polymer/polymer.html" rel="import">
<link href="paper-dialog/paper-dialog.html" rel="import">
<dom-module id="content-el">
<template>
<button on-tap="show">Click to show dialog</button>
<paper-dialog id="dialog" modal>
<h2>Header</h2>
<div>Dialog body</div>
</paper-dialog>
</template>
<script>
(function(){
Polymer({
is: 'content-el',
properties: {},
show: function() {
this.$.dialog.open();
},
});
})();
</script>
</dom-module>
This is a known (see this and this github issue) but unfortunately not very well documented limitations of the iron-overlay-behavior, that is used by
paper-dialog
:One workaround is to move the
paper-dialog
outside of thecontent-el
and also outside of theapp-header-layout
(either into theindex.html
or as a direct child of your rootmy-app
element). You can fire an event (i.e.open-dialog
and handle that in your root element).