-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Complications from shadyCSS @apply shim and lit polyfill support #21748
Comments
@bramkragten or @piitaya, I removed some orphan
Can we get rid of those? I suspect further investigation might show those amount to very minor bugs/differences between modern and legacy for those elements because of this issue. |
There are more usage of the apply in the codebase but they are polymer related. There is not really much more left to remove polymer completely.
|
You can deduplicate them. That is look up what properties they set and copy them over and use css variables. But removing those will still leave the apply in the ha-style and I think it needs removal their too. |
At least for this issue, I left out the ones in |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
Checklist
Describe the issue you are experiencing
Users have been reporting that some custom cards stopped working after being pushed to the legacy build (mistakenly for the iOS companion app). As @piitaya pointed out in home-assistant/iOS#2908 (comment), this is the result of those cards using dynamic styles in their templates, which are not supported by the shadyCSS polyfill. However, we only load that polyfill when shadow DOM is not supported, so it shouldn't be an issue. I decided to look into what's going on here.
What we do load unconditionally in the legacy build is
lit/polyfill-support
, which is needed whenever the web components polyfills are active. That support adds some functions for Lit with a short-circuit that looks like:It turns out that this short circuit doesn't work because we still use some
<paper-*>
components, which always load the shim for CSS@apply
(via@polymer/polymer/polymer-legacy.js
). So the end result is that thelit/polyfill-support
effects are always active on the legacy build. Whether@apply
is used by the cards or not, Lit's polyfill support ends up also forcing those shadyCSS limitations.Describe the behavior you expected
Fortunately, there's a number of ways to address these complications:
classMap
orstyleMap
directives should be used. @piitaya I think you suggested adding some notes to the docs on this and perhaps a developer blog post - can you take care of that?lit/polyfill-support
on the modern build at all, so clearly we don't need it just for the@apply
shim (probably because no lit elements actually use it, just thepaper-*
polymer elements). I'll modify this so we only load it when shadyDOM is active.<paper-*>
elements, and thus the@apply
shim will stop polluting our bundles along with plenty more polymer stuff. Thanks to @silamon, these have mostly been eradicated and there's only a few locations left (sidebar and dashboard tabs).@apply
with legacy paper styles. It's time to get rid of those, especially since the@apply
proposal was abandoned years ago as a bad idea.Steps to reproduce the issue
Can verify why the lit polyfill support is active just by looking at
window.shadyCSS
in the browser console.What version of Home Assistant Core has the issue?
dev
What was the last working version of Home Assistant Core?
No response
In which browser are you experiencing the issue with?
n/a
Which operating system are you using to run this browser?
n/a
State of relevant entities
No response
Problem-relevant frontend configuration
No response
Javascript errors shown in your browser console/inspector
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: