Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

element-styles/paper-material.html needs a unique dom-module id #130

Closed
mbinette opened this issue Mar 10, 2017 · 7 comments
Closed

element-styles/paper-material.html needs a unique dom-module id #130

mbinette opened this issue Mar 10, 2017 · 7 comments

Comments

@mbinette
Copy link

mbinette commented Mar 10, 2017

In 2.0-preview the standard <paper-material> will not be visible if you include a <paper-button> or <paper-card> in your component.

The reason is that element-styles/paper-material.html has a component in it with the definition <dom-module id="paper-material"> which is the exact definition that is in paper-material/paper-material.html.

The change to element-styles was added in the 1.2 tag and is used in the 2.0-preview branch and 2.0-preview branch versions of paper-card and paper-button (and maybe others?)

To repeat the issue, create a new polymer-2-starter-kit application. Modify bower.json to include paper-material and paper-button. Open my-view.html and add a <paper-material> with some text in it. Run the app and you will properly see the paper-material on my-view1.

Edit my-view1.html and import paper-button. Add a paper-button under the paper-material. Run the app and you will see the button but no longer see the paper-material or its content.

The exact same issue exists for element-styles/paper-item.html

@notwaldorf
Copy link
Contributor

Neither of those elements uses paper-material anymore, and in 2.0 paper-material is deprecated in favour of the styles, so I think this shoooould be ok. I agree that if you use both it won't work, but we recommend not using a paper-material element at all (since it's an anti-pattern).

Does this sound ok?

@mbinette
Copy link
Author

mbinette commented May 8, 2017

OK, I removed the <paper-material> elements and replaced with paper-material style. Works. I didn't know the paper-material component was being deprecated in 2.0.

@mbinette mbinette closed this as completed May 8, 2017
@notwaldorf notwaldorf reopened this May 9, 2017
@notwaldorf
Copy link
Contributor

Actually, I'm going to re-open this because it needs to be fixed. The element-styles/paper-material.html needs to be renamed to something like paper-material-styles, so that the ids don't conflict

@pimenteljchristopher
Copy link

You changed the naming for core components of paper-button ..
polymerv2

@dman777
Copy link

dman777 commented Aug 31, 2018

@notwaldorf If I may ask, please, what is it about paper-material that is a anti-pattern? For learning and best practices.

@notwaldorf
Copy link
Contributor

Since you also asked me on twitter, here's that answer here: the anti-pattern was <paper-material> the element, not the shared style, bc it just added a box-shadow. given that a shadow root and creating an element are not free, it was faaaaar too expensive for what it did (literally just add a box-shadow)

@dman777
Copy link

dman777 commented Oct 3, 2018

@notwaldorf Just to confirm, would this be also considered a anti pattern? It seems this is just webcomponent that is styled with no JS. Where the same thing can be done without a webcomponent using iron-overlay-backdrop?

https://github.com/PolymerElements/iron-overlay-behavior/blob/master/demo/simple-overlay.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants