Skip to content
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

Entities card with conditional row - card’s height is changing when it shouldn’t #7292

Open
ildar170975 opened this issue Oct 9, 2020 · 18 comments
Labels
Bug Current Bug in UI - Extra Attention

Comments

@ildar170975
Copy link
Contributor

ildar170975 commented Oct 9, 2020

Checklist

  • [ x ] I have updated to the latest available Home Assistant version.
  • [ x ] I have cleared the cache of my browser.
  • [ x ] I have tried a different browser to see if it is related to my browser.

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

  1. Create 2 cards (code is provided below).
  2. Place them in one line.
  3. Note that both the cards have the same height.
  4. Switch a state on any of these cards.
  5. Now you see that one card has a bigger height.

Environment

  • Home Assistant release with the issue: 0.116.0
  • Last working Home Assistant release (if known):
  • Browser and browser version: Firefox 81.0.1
  • Operating system: Win10x64

State of relevant entities

Problem-relevant configuration

Card 1:

type: entities
entities:
  - input_boolean.test_boolean
  - type: conditional
    conditions:
      - entity: input_boolean.test_boolean
        state: 'on'
    row:
      entity: sun.sun
  - type: conditional
    conditions:
      - entity: input_boolean.test_boolean
        state: 'off'
    row:
      entity: sun.sun

Card 2:

type: entities
entities:
  - entity: input_boolean.test_boolean
  - entity: sun.sun

Javascript errors shown in your browser console/inspector

Additional information

@ildar170975 ildar170975 added the Bug Current Bug in UI - Extra Attention label Oct 9, 2020
@spacegaier
Copy link
Member

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:

#states > *:first-child {
margin-top: 0;
}
#states > *:last-child {
margin-bottom: 0;
}

@github-actions
Copy link

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.

@github-actions github-actions bot added the stale label Jan 20, 2021
@ildar170975
Copy link
Contributor Author

ver 2021.1.4 - the problem is still present.

@github-actions
Copy link

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.

@github-actions github-actions bot added the stale label Apr 22, 2021
@ildar170975
Copy link
Contributor Author

2021.4.6 - problem still present.

@github-actions
Copy link

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.

@github-actions github-actions bot added the stale label Jul 21, 2021
@ildar170975
Copy link
Contributor Author

2021.7.1 - the bug is present

@github-actions github-actions bot removed the stale label Jul 21, 2021
@github-actions
Copy link

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.

@github-actions github-actions bot added the stale label Oct 19, 2021
@ildar170975
Copy link
Contributor Author

2021.10.6 - the bug is present

@github-actions github-actions bot removed the stale label Oct 19, 2021
@ildar170975
Copy link
Contributor Author

2021.11.5 - the bug is present

@emufan
Copy link
Contributor

emufan commented May 8, 2022

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.

@github-actions
Copy link

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.

@github-actions github-actions bot added the stale label Aug 21, 2022
@emufan
Copy link
Contributor

emufan commented Aug 21, 2022

Problem still there.

@karwosts
Copy link
Contributor

karwosts commented Jul 7, 2023

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.

Copy link

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.

@github-actions github-actions bot added the stale label Dec 11, 2023
@ildar170975
Copy link
Contributor Author

up

@github-actions github-actions bot removed the stale label Dec 15, 2023
Copy link

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.

@github-actions github-actions bot added the stale label Mar 14, 2024
@ildar170975
Copy link
Contributor Author

up

@github-actions github-actions bot removed the stale label Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Current Bug in UI - Extra Attention
Projects
None yet
Development

No branches or pull requests

5 participants