frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Vertical Stack with Conditional Card - Creating White Space

Open mynameisdaniel32 opened this issue 5 years ago • 29 comments

Home Assistant release with the issue: 0.83.2

Last working Home Assistant release (if known): Unsure

Browser and Operating System: Chrome & Safari (macOS)

Description of problem: When using a conditional card in a vertical-stack, when the first card is hidden, there is white-space created in its place, bumping the next card down slightly by a few pixels.

Ignore my messy test page, but the below screenshots show when the first item in my vertical stack is shown (on the right half), the top of the right panel is level with the items on the left. When I go to any other item in this vertical stack being the first displayed, the top edge sits a few pixels lower. Switching between the second and third items doesn't add to the gap, the space only seems to appear when the first item is hidden.

image

image

Javascript errors shown in the web inspector (if applicable): N/A

Additional information: `

  - type: vertical-stack
    cards:
      - type: conditional
        conditions:
          - entity: input_select.tablet_panel_detail
            state: "Lights"
        card:
          (LIGHT CARD)

      - type: conditional
        conditions:
          - entity: input_select.tablet_panel_detail
            state: "Lights Advanced"
        card:
          (ADVANCED LIGHT CARD)

      - type: conditional
        conditions:
          - entity: input_select.tablet_panel_detail
            state: "Media"
        card:
          (MEDIA CARD)

`

mynameisdaniel32 avatar Dec 02 '18 01:12 mynameisdaniel32

The problem is caused because all the elements get a margin top and bottom, which are removed on the first (margin-top) and last (margin-bottom) elements. However it's not taking in account if the first (or last) element is visible or not.

Since the first element is hidden (in your case the conditional card), the margin-top of the second element is still visible, which causes a 4px offset.

Unfortunately there is no "nice" fix for this with CSS or vanilla JS, and will require jQuery (or similar) to fix this issue.

Perhaps it's a solution to add a negative padding/margin on the root div, and removing the :first-child and :last-child selectors from the CSS.

Grezvany13 avatar Dec 02 '18 03:12 Grezvany13

related: https://github.com/home-assistant/home-assistant-polymer/issues/2395

iantrich avatar Feb 14 '19 03:02 iantrich

This should have been fixed regarding https://github.com/home-assistant/home-assistant-polymer/pull/1999 but for me it still exists. Hidden conditional cards leave whitespace:

2019-12-13 14_34_38-Home Assistant

barrymossel avatar Dec 13 '19 13:12 barrymossel

I have the same issue too, i have an empty column where a conditional card would show up if the conditions were met.

dfritsch86 avatar Mar 05 '20 15:03 dfritsch86

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 now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 03 '20 16:06 stale[bot]

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 👍

Problem still persists in latest version.

s-hutter avatar Jun 04 '20 17:06 s-hutter

Is there any solution for this? Messing with the CSS in my browser tools but I even after deleting the cards from the layout, they still leave gaps. I'm assuming there is some kind of javascript code that calculates the positions of the cards (ie. Masonry.js), is there any way we can access that API?

alexwohlbruck avatar Jul 17 '20 03:07 alexwohlbruck

There is not js involved, we don't use Masonary. Removing the elements should remove the spacing.

bramkragten avatar Jul 17 '20 09:07 bramkragten

Though the problem still persists.

barrymossel avatar Aug 19 '20 11:08 barrymossel

Facing the same issue, although is important to disitnguish between vertical spaces (Such as the issue author setup), and horizontal spaces. Critical Scenario 2 next:

  1. Scenario 1: Vertical spaces appearing.
  • Hypothesis: An empty vertical stack still populates as a card for layout purposes.
  • Test: 3 cards whatsoever, but second card to be a vertical/horizontal stack card. Include a single card in the stack, to be a conditional card. Set a condition so that it dissapears. Ensure the lovelace viewport is narrow enough so that all cards appear vertically.
  • Issue: When disappearing the middle card conditional card, the other 2 cards won't be right next to each other.
  • WORKAROUND: Encapsulate your vertical/horizontal card inside a conditional card, with condition with some sort of group collection of the subconditions.
  • Expected solution: An empty card shouldn't be rendered at all.
  1. Scenario 2: Horizontal spaces appearing.
  • Hypothesis: The view controller program that calculates how many columns to generate in a wide viewport, takes into account total # of cards, not visible only.
  • Test: 3 cards whatsoever, but second card to be a conditional card. Set a condition so that it dissapears. Ensure the lovelace viewport is wide enough so that all cards appear horizontally (3 columns).
  • Issue: When disappearing the middle card conditional card, the other 2 cards won't be right next to each other; a big empty column is left in the middle.
  • WORKAROUND: NONE.
  • Expected solution: An empty card shouldn't be rendered at all; only 2 columns should appear.

Any help and/or fixes for this would be appreciated! Thanks.

diamant-x avatar Sep 17 '20 23:09 diamant-x

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[bot] avatar Dec 17 '20 00:12 github-actions[bot]

This is still a relevant issue.

barrymossel avatar Dec 17 '20 06:12 barrymossel

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[bot] avatar Mar 17 '21 08:03 github-actions[bot]

And still this issue is relevant. If someone needs more information, I will be happy to provide it!

barrymossel avatar Mar 17 '21 08:03 barrymossel

I still have this issue and can demonstrate/supply config etc. if needed.

bangcrash avatar Mar 17 '21 13:03 bangcrash

Same here. Please fix this annoying bug. There is a workaround of using a grid card with 1 column. Is there something to be learned for the vertical stack card?

ps. i call this a workaround bs when nesting multiple time the grid card with the input #columns takes more precious space on my screen when editting. image

JDunnio avatar Mar 17 '21 20:03 JDunnio

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[bot] avatar Jun 15 '21 21:06 github-actions[bot]

This is still a problem as of version 2021.6.5

bangcrash avatar Jun 15 '21 21:06 bangcrash

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[bot] avatar Sep 13 '21 23:09 github-actions[bot]

This is still a problem as of version 2021.9.6 and I can reproduce/demonstrate if necessary

bangcrash avatar Sep 14 '21 08:09 bangcrash

Still a problem in 2021.10

Glennesink avatar Oct 18 '21 21:10 Glennesink

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[bot] avatar Jan 16 '22 22:01 github-actions[bot]

Still happening in 2021.12.9

bangcrash avatar Jan 17 '22 11:01 bangcrash

This is still an issue in 2022.2.0b4. The empty space above the Seasonal Decorations entities card in the screenshot corresponds to a vertical stack card containing two hidden conditional cards.

Screenshot from 2022-01-31 07-55-10

type: vertical-stack
cards:
  - type: conditional
    conditions:
      - entity: media_player.sonos_beam
        state: playing
      - entity: sensor.sonos_beam_source
        state_not: TV
    card:
      type: media-control
      entity: media_player.sonos_beam
  - type: conditional
    conditions:
      - entity: media_player.sonos_move
        state: playing
    card:
      type: media-control
      entity: media_player.sonos_move

krazos avatar Jan 31 '22 13:01 krazos

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[bot] avatar Jun 03 '22 05:06 github-actions[bot]

Still an issue in 2022.6.1

krazos avatar Jun 03 '22 11:06 krazos

Also confirm is still an issue in 2022.6.1. I also checked github issue tracker and now this is officially the oldest still open bug report in Github Homeassistant Frontend with 3.5 years old https://github.com/home-assistant/frontend/issues?q=is%3Aissue+is%3Aopen+sort%3Acreated-asc

Thanks.

image

diamant-x avatar Jun 03 '22 12:06 diamant-x

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[bot] avatar Sep 19 '22 16:09 github-actions[bot]

This is still an issue as of 2022.9.5.

krazos avatar Sep 19 '22 16:09 krazos

Since this issue never got the attention it deserves in my opinion, I decided to mention it in a post for the current "What the heck?" month of October 2022: https://community.home-assistant.io/t/471426 Votes are very much welcome to finally give this way too old bug more visibility. 🙂

s-hutter avatar Oct 07 '22 13:10 s-hutter