thomasloven / hass-browser_mod

πŸ”Ή A Home Assistant integration to turn your browser into a controllable entity and media player
MIT License
1.31k stars 187 forks source link

Popup window overflows in Android companion app #530

Open slovdahl opened 1 year ago

slovdahl commented 1 year ago

My Home Assistant version: 2023.1.5 HA Android companion version: 2023.1.1-full

I'm not sure where exactly the bug is, but I need to start somewhere. Please point me in the right direction if I'm in the wrong place.

What I am doing:

Opening a browser_mod popup (in tap_action for a button card) using action: fire-dom-event and service: browser_mod.popup.

What I expected to happen:

The popup is opened and does NOT overflow.

What happened instead:

I have been running the same HA server, HA companion app and all HACS plugin versions for about a week when this suddenly started happening ~1 week ago. I'm fairly confident that a Chrome or Android System WebView update broke it as both the HA companion app and Chrome are broken in the same way.

I managed to attach my desktop Chrome's dev tools to my Android phone's Chrome and was able to tweak the width of the popup and get it fully visible, but I'm way out of my comfort zone when it comes to CSS (and JS) these days so I wasn't able to understand why it happened. But I'm happy test specific things out via the Chrome dev tools if needed.

Minimal steps to reproduce:

Minimal dashboard that reproduces the problem by tapping on the card (just replace the three light entities with lights or switches):

title: Overflow bug
views:
  - theme: Backend-selected
    title: Home
    type: panel
    badges: []
    cards:
      - type: button
        entity: light.light_group
        name: Lights
        tap_action:
          action: fire-dom-event
          browser_mod:
            service: browser_mod.popup
            data:
              title: Lights
              content:
                type: entities
                entities:
                  - entity: light.light_1
                    name: Light 1
                  - entity: light.light_2
                    name: Light 2

HA companion app on Android

ha-app-android

Firefox on Android

firefox

Error messages from the browser console:

Nothing interesting in the console on any of the desktop browsers, but the Firefox one attached:

BROWSER_MOD 2.2.0 IS INSTALLED
    BrowserID: afac19fb-afc6cdfd [browser_mod.js:407:6092](https://hostname/browser_mod.js)
CARD-MOD 3.2.0 IS INSTALLED [card-mod.js:5:247](https://hostname/hacsfiles/lovelace-card-mod/card-mod.js)
πŸ„ Mushroom πŸ„ - 2.5.2 [mushroom.js:2960:104](https://hostname/hacsfiles/lovelace-mushroom/mushroom.js?hacstag=444350375252)
  BUTTON-CARD  
 Version 3.4.2 [button-card.js:425:4478](https://hostname/hacsfiles/button-card/button-card.js)
  TIME-PICKER-CARD  
  Version 1.4.0    [time-picker-card.js:150:2349](https://hostname/hacsfiles/lovelace-time-picker-card/time-picker-card.js?hacstag=261262884140)
vertical-stack-in-card
Version: 0.4.4 [vertical-stack-in-card.js:1:9](https://hostname/hacsfiles/vertical-stack-in-card/vertical-stack-in-card.js?hacstag=142051833044)
SLIDER-ENTITY-ROW 17.3.0 IS INSTALLED <empty string> [slider-entity-row.js:82:184](https://hostname/hacsfiles/lovelace-slider-entity-row/slider-entity-row.js?hacstag=1448997001730)
TEMPLATE-ENTITY-ROW 1.3.0 IS INSTALLED <empty string> [template-entity-row.js:51:267](https://hostname/hacsfiles/lovelace-template-entity-row/template-entity-row.js?hacstag=231674882130)
 MINI-GRAPH-CARD  0.11.0 [mini-graph-card-bundle.js:1:95970](https://hostname/hacsfiles/mini-graph-card/mini-graph-card-bundle.js?hacstag=1512800620110)
 VACUUM-CARD  2.6.2 [vacuum-card.js:4:17736](https://hostname/hacsfiles/vacuum-card/vacuum-card.js?hacstag=261291295263)
  SCHEDULER-CARD  
  Version: v2.3.6 [scheduler-card.js:1885:1375](https://hostname/hacsfiles/scheduler-card/scheduler-card.js?hacstag=286270157326)
  BAR-CARD 
  Version 3.1.7    [bar-card.js:4855:9](https://hostname/hacsfiles/bar-card/bar-card.js?hacstag=163363577320)
AUTO-ENTITIES 1.12.1 IS INSTALLED [auto-entities.js:172:7850](https://hostname/hacsfiles/lovelace-auto-entities/auto-entities.js?hacstag=1677445841121)

By replacing the space in the checkboxes ([ ]) with an X below, I indicate that I:

finalbillybong commented 1 year ago

This is also happening in the iOS companion app but is fine in Safari.

slovdahl commented 1 year ago

@finalbillybong Interesting, I did try it in my wife's iOS companion app too without being able to reproduce. Do you have an example of it?

finalbillybong commented 1 year ago

I sure do.

344A757E-1026-4752-AADE-C1F42195F90D

finalbillybong commented 1 year ago

And I Safari it’s fine.

E0A22F8E-F243-4B1A-B7BD-9EF818902A64

KoljaWindeler commented 1 year ago

Same issue on a simple chrome window on Android here ..

markwoodward86 commented 1 year ago

I would like to jump on the reporting bandwagon. Fullscreen pop up works fone but does not work in my use case. Wide, normal, and none have the same overflow effect which cuts off vital info.

I do not that i have my text size accessibility settings (android, pixel 6 pro) set to the smallest font size, if i put back to normal the pop up seems fine. Unfortunately i cant have the normal font size.

abigdeel commented 1 year ago

Noticing this on my Pixel 7 Pro as well, and only on the companion app.

Not an issue in a web browser on my Pixel 7 Pro or in Home Assistant Desktop (Windows 11). Oddly enough, also not an issue on a Pixel 1, but it seems to be running an older version of the app.

slovdahl commented 1 year ago

Much guesswork here now.. Looks like the OnePlus 8 Pro viewport is wider than 450 px but narrower than 560 px, and for some reason the --popup-min-width from these defaults is not applied. Instead --mdc-dialog-min-width falls back to a default of 560 px => overflow.

Anyway, by adding πŸ‘‡ to my popups I managed to work around it.

style: |
  --popup-min-width: 400px;

And in the full example in the original post:

title: Overflow bug
views:
  - theme: Backend-selected
    title: Home
    type: panel
    badges: []
    cards:
      - type: button
        entity: light.light_group
        name: Lights
        tap_action:
          action: fire-dom-event
          browser_mod:
            service: browser_mod.popup
            data:
              title: Lights
              style: |
                --popup-min-width: 400px;
              content:
                type: entities
                entities:
                  - entity: light.light_1
                    name: Light 1
                  - entity: light.light_2
                    name: Light 2
markwoodward86 commented 1 year ago

You saint. Thank you!

slovdahl commented 1 year ago

Opening πŸ‘‡ in Chrome and Firefox on my OnePlus 8 Pro yields some interesting results πŸ€”

<!DOCTYPE html>
<html>
    <body><h1><script type="application/javascript">document.write(window.innerWidth);</script></h1></body>
</html>

Firefox:

firefox

Chrome:

chrome

alexandoe commented 1 year ago

Same issue for me in companion app on Pixel 6 Pro.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

slovdahl commented 1 year ago

Still an issue.

silvioped commented 1 year ago

Same probleme here, iOS 16 (wife) and iOS 17 (me), companion app, safari and chrome have the issue.

stale[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

slovdahl commented 10 months ago

Still an issue.

scarecrowddb commented 7 months ago

This is still and issue

isewise commented 6 months ago

Still an issue.