Metrology-for-Hass icon indicating copy to clipboard operation
Metrology-for-Hass copied to clipboard

Problem with overflow for dialog tooltips

Open beauwest opened this issue 3 years ago • 6 comments

Hey! Tooltips for the entity detail dialogs are cut off instead of overflowing their container.

Behavior

Screen Shot 2022-05-10 at 8 13 08 AM

Expected

Screen Shot 2022-05-10 at 8 16 14 AM

beauwest avatar May 10 '22 13:05 beauwest

Hmmmmmm I'm stumped on this one. After commenting out a bunch of codes to trace the bug, I've come to the conclusion that CSS backdrop-filter and filter breaks how it handles overflow of a block.

I did manage to fix it by disabling the overflow-y property of .mdc-dialog__surface and .content. But the problem is that sometimes cards do overflow (e.g. when it has a lot of attributes) so I can't fix it this way...

If anyone had experience fixing this one, please let me know!

Madelena avatar May 11 '22 08:05 Madelena

I'm looking into it too, it has something to do with the .mdc-dialog__surface::before, but I can't figure out the differences yet. The position: absolute and width/height: 100% is supposed to be based on the entire page, but right now it's based on the dialog element.

I have to get to work, but if I have time, I'll dig into it more.

beauwest avatar May 11 '22 11:05 beauwest

The solution here will temporarily fix the scrollbar problem, but you lose the transparency blur in the process:

https://github.com/Madelena/Metrology-for-Hass/issues/7

Madelena avatar May 11 '22 21:05 Madelena

I stumbled on a partial solution, it fixes overflow for tooltips while retaining the blur effect

Tooltip Overflow - Light Mode Tooltip Overflow - Dark Mode

  card-mod-more-info-yaml: &card-mod-more-info-yaml |
    $: |
      @supports (-webkit-backdrop-filter: none) or (backdrop-filter: none) {
        .mdc-dialog__surface {
          backdrop-filter: blur(16px);
          -webkit-backdrop-filter: blur(16px);
          background-color: rgba(var(--rgb-mdc-theme-surface), .5) !important;
        }
      }
      .mdc-dialog .mdc-dialog__container .mdc-dialog__surface {
        overflow: visible;
      }
      .mdc-dialog__surface {
        box-shadow: 0 0px 16px 4px rgba(var(--dialog-box-shadow), .15), 0 16px 64px 32px rgba(var(--dialog-box-shadow), .5) !important;
      }

However, dropdowns render incorrectly but it makes them more usable than before as noted in #28

Dropdown - Dark Mode

I am no CSS expert, but if I remove the top and left style properties from this element, it returns to the proper position. I'm not sure how to apply this fix to the CSS though.

Inspect

Position Fixed

zanix avatar Aug 24 '22 16:08 zanix

Cool! Thank you and let me try this fix out.

Madelena avatar Aug 25 '22 05:08 Madelena

Dropdowns seem to have been almost fixed with Home Assistant v2022.9.0 when using the overflow fix image

Without the overflow fix, dropdowns cause scrollbars to show, but still show (almost) in the correct location image

And the tooltips causing scrollbars still occur without the overflow fix image

zanix avatar Sep 09 '22 04:09 zanix

It's probably not an issue anymore since HA 2022.10 changed all the dialogs.

image

Madelena avatar Jan 04 '23 04:01 Madelena

~The overflow issue is still present for me on HA 2022.12~ Nevermind, the fix is in v1.8

image

image

zanix avatar Jan 04 '23 04:01 zanix

Ah, I see my fix was added to v1.8

zanix avatar Jan 04 '23 05:01 zanix

I had an issue with overflows and after manually applying a fix from @zanix it now looks like this: obraz

What can I do about it?

I'm on HA 2022.12.9 and Metrology 1.7.2 installed via HACS.

mmalolepszy avatar Jan 04 '23 07:01 mmalolepszy