Open ildar170975 opened 3 years ago
I traced the problem, but I am unable to find a good solution currently.
These CSS selectors cannot take into account whether an element is hidden or not, so if the bottom or top entity in a card is hidden the margins do not properly add up, resulting in the size jumps:
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. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
ver 2021.1.4 - the problem is still present.
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. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
2021.4.6 - problem still present.
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. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
2021.7.1 - the bug is present
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. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
2021.10.6 - the bug is present
2021.11.5 - the bug is present
These CSS selectors cannot take into account whether an element is hidden or not, so if the bottom or top entity in a card is hidden the margins do not properly add up, resulting in the size jumps:
I think some libraries as jquery can distinguish between hidden and not hidden items. Perhaps this can be adopted here as well?
Other wise, why has the hui-vertical-stack-card top margin 4 and bottom margin 8 and the included items have 4+4 but only the first has 0(top)+4(bottom) and the last 4+0.
The problem would not be there, if hui-vertical-stack-card has only 0+4 and every ìncluded item would have 4+4. Or am I wrong? Then you don't have to distinguish between hidden and shown items.
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. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Problem still there.
While I admit this is not a fix, if the changing height bothers you, you can add this item as the last element in the list:
- type: divider
style:
display: none
This adds an invisible div as the last item in the entites list, and therefore the card height will no longer change when entities become conditionally visible/invisible.
Maybe also need one as the first item in the list, depending on where your conditional elements are.
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. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
up
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. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
up
While I admit this is not a fix, if the changing height bothers you, you can add this item as the last element in the list:
- type: divider style: display: none
This adds an invisible div as the last item in the entites list, and therefore the card height will no longer change when entities become conditionally visible/invisible.
Maybe also need one as the first item in the list, depending on where your conditional elements are.
cant help but wondering if introducing an 'else' wouldn't fix this.
Talked/wondered about the lack of a default value (else) on the core conditional very often, and it in fact seems the only true missing feature now, compared to eg custom:state-switch.
it would allow the 2 conditionals to be written as 1, and hence only take 1 spot in the entities card
so. in stead of
- type: entities
entities:
- input_boolean.test
- type: conditional
conditions:
- entity: input_boolean.test
state: 'on'
row:
entity: sun.sun
- type: conditional
conditions:
- entity: input_boolean.test
state: 'off'
row:
entity: sun.sun
use:
- type: entities
entities:
- input_boolean.test
- type: conditional
if:
conditions:
- entity: input_boolean.test
state: 'on'
row:
entity: sun.sun
else:
row:
entity: sun.sun
btw, the fact the vertical-stack does not suffer this when using the identical conditions on eg a core entity card, would give us reason to think the entities card should be 'fixable'?
- type: vertical-stack
cards:
- type: entity
entity: input_boolean.test
- type: conditional
conditions:
- entity: input_boolean.test
state: 'on'
card:
type: entity
entity: sun.sun
- type: conditional
conditions:
- entity: input_boolean.test
state: 'off'
card:
type: entity
entity: sun.sun
https://github.com/home-assistant/frontend/assets/33354141/ec0fd74a-1dad-4aeb-ad6f-a76089869401
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. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Up
Checklist
The problem
When an Entities card has at least one conditional row (one row if condition "true", another row if condition "false" - i.e. "show one row instead another row"), then the card's height is changing dependently on condition - but it shouldn't since total number of rows is not changing. Look at the pics below: https://community-assets.home-assistant.io/optimized/3X/f/a/fa3d51ea8ad8d1cf85722e3c73911c08738bdcf3_2_690x127.jpeg https://community-assets.home-assistant.io/optimized/3X/c/5/c54c23bac64adeaebd0779b30f5138d894edb780_2_690x137.jpeg
Expected behavior
Both the cards should have the same height - because total number of rows was not changed.
Steps to reproduce
Environment
State of relevant entities
Problem-relevant configuration
Card 1:
Card 2:
Javascript errors shown in your browser console/inspector
Additional information