-
Notifications
You must be signed in to change notification settings - Fork 2k
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
overriding the custom css variables only works for the first dom element on the page #1752
Comments
Thx for the detailed report. There are a couple of issues here but we have a line on tracking them and the fix is pretty simple. The elements will need to be updated because the way they are specifying defaults was relying on incorrect behavior. |
Beginning of fix available here: https://github.com/Polymer/polymer/tree/fix-1752. Requires some testing before it can be merged. Elements will need to update the way the specify default values. |
For reference, custom properties to not inherit values from below them in the tree. See the following in FF: http://jsbin.com/sepuwunifi/1/edit |
great to hear it will get fixed !
ah, okay, makes sense. I needed to change |
Could this issue be relative also to my case where element's defined variables for the element with a custom class doesn't work? http://plnkr.co/edit/JgFOh8hIxp2aisOecg1O?p=preview Update: Nope, my issue is that :host(.theme-default) selector is not implemented yet |
For |
In my experience I've also found that sometimes generated css has only the rules with custom variables inside, like in this element's css: <style>
::content .somediv {
background: blue;
color: var(--my-element-color);
}
</style> only the color rule is generated while the background is skipped, I haven't found a reproducible test case but maybe it could be related to this sone since the first element in the page that declares similar css has all the values set correctly. Update: issue is that element doesn't have a Maybe it's worth another issue or is it "per-design"? |
…ents are styled. Fixes #1752 where an element that uses only values supplied by variable defaults can be incorrectly styled.
tldr: http://plnkr.co/edit/PxEdsV?p=preview
I was playing around different material design themes, and it is not completely clear to me in which way I can override the custom css style variables.
For example, let's say that I would have two themes:
Now if a dom element has such a class, and if it contains paper-elements, I would think that those paper-elements would drop their default styling and instead uses the variables defined in the class:
This does happen for the first dom element on the page. But the second dom element, actually get the styling of the first dom element. So, that is really strange, I would think it would maybe do nothing, and it gets the default styling, but the second element inherits the custom styling of the first dom element...
see: http://plnkr.co/edit/PxEdsV?p=preview
If I do this workaround, it works as I would expect:
If I have a custom element with lots of different paper-elements, it feels bit redundant if I would have to define all the default styling of the paper elements, again, especially, as it is already somewhere defined.
The text was updated successfully, but these errors were encountered: