I have an issue since a few weeks where the background of a card doesnât load occassionally. It issue occurs maybe 25% of the times on my phone and 90% of the times on my laptop.
This is only an issue on the first lovelace tab and the content of the card doesnât matter, same layout on other cards but they work fine. Changing the order of the tabs still causes the issue only on the first tab. I have simplified it to a markdown card with just a table and the word âTestâ and I still get the issue. Hitting Ctrl-F5 solves the issue always.
I donât know if this would improve the situation, but why do you set the variable there and not directly the background? At least, this is one assignment iteration, which can be reduced. And secondly (as workaround), you can apply themes per card as well, if the problem will not be solved, where you can overwrite.as well.
You are assigning your color to the variable --ha-card-background. So here you donât set the color of the background, but only the variable, which is then only applied in a second step to the background. Possible as well:
Hey guys,
I am struggling with changing the borders of my card as well as animate the icon at the same time. I have tried various combinations of code I found in this thread but as I do not understand how the structure works I cannot find a solution. I only found examples for one or the other. When I copy everything from the example page below, I can get the icon to move. However, the corners do not line up, the background color doesnât get applied and the border does not show up either.
My goal is to animate the trash can as well as change the color depending on the stat_attr of the calendar. Last but not least everything should fit together nicely. Which I donât know how to do.
I do not know how to differentiate between ha_card and ha-icon. So it is possible the current version doesnât make any kind of sense to someone who knows what they are doing.
Iâd appreciate any kind of help. Thank you.
edit: I also found the page where the is a code example for the animations. But that leads me to the same problem that I do not know how to put it into my existing code.
Thanks for looking into this, and I see your point which makes sense. I changed the code but unfortunetely the inconcistant behaviour continues.
Edit:
Just realized that this is not background specific but affects all cards in the first tab. A simple text card with a different font is not loaded properly either. As always, a Ctrl-F5 fixes the issue temporarily.
Am I the only one with this issue? Nothing has changed in my code, this started happening a few weeks ago. Have no clue where to start looking or debugging.
And: I donât think (if I can see it correctly from the path (btw, there you can always find how to address as well, here div.current) on bottom of your screenshot, as the tree is not complete, that you have to go in the shadow, so try .: | instead of $: |
so what did you end up with Tom?
Also having my share of issues here (on another card btw, the new horizon-card) , and hope to find some help in your solutionâŚ
NOTE 2: Following on the note above; due to the high level of load order optimization used in Home Assistant, it is not guaranteed that the #shadow-root or the mwc-button actually exists at the point in time when card-mod is looking for it. If you use the second method above, card-mod will be able to retry looking for #shadow-root at a later point, which may lead to more stable operation.
In short; if things seem to be working intermittently - try splitting up the chain.
I previously made this with a markdown card, which is what broke.
After asking here, I subsequently logged this issue, because I could see the <style> wasnât being injected at all levels. I then later on spotted that some elements are dynamically reloaded, the the style appears shortly before disappearing. I fear thereâs nothing card-mod can do about this.
How do you mean with getting the path right? This worked perfectly for months and then all of a sudden it stopped working but works occasionally and a Ctrl-F5 always works and on my phone it works almost all the time. So feels like it should be OK code wise?
Getting a bit desperate here since that background is very important for my way of designing HA dashboards
How are you resonating around this, waiting for a fix or trying to solve it?
Summare of devices:
Android phone (app). Works fine 9/10 times
iPad, tried a few times and worked just fine
Firefox on my laptop, seems to work fine
Chrome on laptop: Works 1/10 times. hard refresh solves the issue.
I need to figure out how to address this image using card-mod. I want to set a max height. I just canât seem to figure out what to put in front of the curly brace. What I have below is effectively what I want, but itâs obviously not working. What do I replace âimgâ with?
The keys in your card-mod config thatâs basically a CSS selector (the path).
You showed that you had an empty <style> element, so whatâs in your config isnât ending up where it should or where you are expecting it to be. I canât say what the answer is, besides that you need to investigate the path (see above). Something could be sitting at a different level in the HTML than where it used to be.
Honestly, I hate to admit this, but I gave up on my old solution. I tried every CSS trick known to me but couldnât get anything reliable working. I didnât want to install another custom card (there are cards for rendering HTML or your custom tables), so I just coded it with HTML and some JS to construct my table, and then CSS to style it, all in a fake custom button card. Iâm not posting my solution here as itâs would be off topic, but I can DM it to you or you can start a new thread and tag me.
Sorry to hear, makes me realize that I might have to reconsider my entire layout since it heavily relies on card-mod and CSS being applied. Initally thought it was the background that was the issue but now I know itâs the applying of CSS to markdown cards that is the issue.
Please share your workaround in a PM and Iâll see if I can use it.
@thomasloven, should I create a github issue on this or do you have any ideas why we have this issue? My original post about this issue is here.