You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a disabled property, which I use to style my polymer widget into a disabled state. This was working fine, until I introduced css variables into my styling.
Here is a simplified example where I have replicated the bug:
<!-- x-button.html -->
<dom-module id='x-button'>
<style>
:host {
/* This breaks it */
background-color: var(--x-button-background-color, orange);
/* Un-comment this code, and remove the previous line of code to fix it */
/*
background-color: orange;
*/
}
:host([disabled]) {
cursor: default;
background-color: red;
}
</style>
<template>
<content></content>
</template>
</dom-module>
<script>
Polymer({
is:'x-button',
properties: {
disabled: {
type: Boolean,
value: false
}
}
});
</script>
Looking in the Chrome inspector, the styling applied by the disabled selector is being overwritten by the by the regular host styling, but only when css variables are present. Without the css variable, the attribute selector is applied correctly, as described here.
This is the first bug I have ever submitted, sorry if I have done something incorrectly.
The text was updated successfully, but these errors were encountered:
#1873
This is the very same problem. That's the way custom styles actually work (for the moment), overwriting all the native CSS that comes after or before them, because the <style> stack in the <head> that polymer adds creates the variables <style> after the native one.
<head><stylescope="my-element">nativecssrules</style><!-- native css --><stylescope="my-element-0">cssrulesfromvariables</style><!-- if any rule is repeated, this will overwrite the native css --></head>
Closing as a duplicate of #1873 (which is a P1 issue that is slated for fixing/improvement). @TylerPachal please watch that issue for resolution. Thanks.
I have encountered what I believe to be a bug.
I have a
disabled
property, which I use to style my polymer widget into a disabled state. This was working fine, until I introduced css variables into my styling.Here is a simplified example where I have replicated the bug:
And here is my simple test:
Looking in the Chrome inspector, the styling applied by the
disabled
selector is being overwritten by the by the regular host styling, but only when css variables are present. Without the css variable, the attribute selector is applied correctly, as described here.This is the first bug I have ever submitted, sorry if I have done something incorrectly.
The text was updated successfully, but these errors were encountered: