-
Notifications
You must be signed in to change notification settings - Fork 71
Conversation
e78b795
to
499faa5
Compare
<link rel="import" href="iron-overlay-manager.html"> | ||
|
||
<!-- | ||
`iron-overlay-container` stamps overlays to `document.body` in order to avoid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'stamps' is a bit of a pedantic term. Can we use something more user friendly? Adds? Creates?
@notwaldorf feedback incorporated! @cdata FYI, here's the PR for overlays 2.0 |
105714e
to
1c4da0f
Compare
d390e91
to
194de78
Compare
e8a1e24
to
f28c01d
Compare
b7b2f91
to
38ee299
Compare
fd21f6d
to
ef0e54e
Compare
ae8febf
to
8b62268
Compare
8b62268
to
7872cfa
Compare
2ded959
to
17a0975
Compare
Fixes PolymerElements/paper-dialog#7 Fixes Polymer/polymer-starter-kit#154 Fixes (maybe) PolymerElements/paper-dialog#79 Fixes (maybe) PolymerElements/paper-dialog#44 Fixes (maybe) PolymerElements/paper-drawer-panel#122 Related to PolymerElements#72 Related to PolymerElements#86 Related to https://github.com/PolymerElements/iron-overlay-behavior/compare/backdrop-refit Fixes (maybe) PolymerElements/paper-dialog-behavior#78 Fixes PolymerElements/app-layout#155
@valdrinkoshi Any update on this one? |
Any update? |
@Tigerino @zixsma sorry for the late reply. I've updated this PR's description with more info. In short with Polymer 2.0 we'll be able to extend from another custom element but not from the native elements like |
Will close this PR but keep the branch 👌 |
Update
Polymer 2.0-preview will no longer produce type-extension elements (aka
is="..."
) (rationale here), hence we won't merge this PR as it introduces new custom elements extending<template>
.Further work is being done in https://github.com/PolymerLabs/iron-overlay
Further discussion on the issue and how the platform can help users here whatwg/html#2525
The problem
Overlays that are contained into a stacking context that is not the main one (the one of
document.body
) can have positioning problems, cropping, be non-interactive (see example). This is a known limitation mentioned also in the docs:These are some stacking-context-related issues from components relying on
iron-overlay-behavior
:PolymerElements/paper-dialog#7
Polymer/polymer-starter-kit#154
PolymerElements/paper-dialog#79
PolymerElements/paper-dialog#44
PolymerElements/paper-drawer-panel#122
Proposal
paper-menu-button
use case)This is achieved with 4 components:
iron-overlay-template
It is a template that takes care of stamping the overlay and delegating the attach to the listeners of the event
iron-overlay-template-attach
. Styles can be added into the template, they’ll be appended into the shadowDOM as well. It provides a handy pointer to the overlay instance (myTemplate.overlay
).iron-overlay-container
It is the Right Place™. It listens to the
iron-overlay-template-attach
event and appends the overlay in its shadowDOM (so that style encapsulating is guaranteed). You can declare multiple instances (e.g. 1 container for toasts and 1 for dialogs).iron-overlay-content-template
It is a template that stamps and appends its content into
contentParent
. This is needed by elements that host an overlay into their shadowDOM and want to distribute content in them, e.g.paper-menu-button
needs to distribute dropdown content into theiron-dropdown
declared in its shadowDOM.iron-overlay-host-behavior
It searches for the
iron-overlay-template
in the shadowDOM and sets it as thecontentParent
of theiron-overlay-content-template
in the lightDOM (the distributed one).This changes the markup of the user of your element like this:
Styling
The content of an
iron-overlay-template
will be added into aniron-overlay-container
's root, so one could define styles into the template:Beware that this applies to all the
paper-dialog
s that will be contained in aniron-overlay-container
.If you are an element author which hosts an overlay into its shadowDOM, you might want to namespace it, so that its styles won't conflict with other overlays of the same kind:
Note for element authors using
iron-host-behavior
: Polymer currently removes allstyle
nodes from a template, so as a temporary solution you'll need to use<script type="css">
instead of<style>
.