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

pop ups not applying styles (HA 0.113 and browser mod 1.1.0) #117

Closed
basesnow opened this issue Jul 24, 2020 · 20 comments
Closed

pop ups not applying styles (HA 0.113 and browser mod 1.1.0) #117

basesnow opened this issue Jul 24, 2020 · 20 comments

Comments

@basesnow
Copy link

Pop ups are functioning, but style is not being applied. Also noticed on my pop ups that they are not centered on screen. Sometimes are partially off screen.

same here..... styles not applied
recorte

Originally posted by @joseska in #115 (comment)

@thomasloven
Copy link
Owner

Since so much is broken anyway, I bit the bullet and moved over to card-mod styles in 1.1.1.
https://github.com/thomasloven/lovelace-card-mod

That means card-mod must be installed for styling to work, and that the syntax is entirely different.

It's a very breaking change, but it's also much more powerful, and means popups can be styled via the theme.
I haven't had the time to come up with a migration guide yet, but I'll keep this issue open and maybe someone will post their discoveries.

Good luck!

@basesnow
Copy link
Author

Welp, this fixed everything for me. I wasn't modifying style of my pop up cards. So I didn't have to change anything. Updated to latest and now the cards are showing up properly. Quick turnaround is an understatement here! Thanks again

@ronaldheft
Copy link

Great change here. 1.1.1 fixed all my popup styles and everything is loading perfectly.

@theone11
Copy link

theone11 commented Jul 24, 2020

Can someone post an example of how to change the width of a popup with the new card-mod?
I tried a few options and couldn't get it to work.

Tried this and still got a small popup

          action: call-service
          service: browser_mod.popup
          service_data:
            card:
              type: custom:mod-card
              style: |
                ha-card {
                  width: 90%;
                  height: 90%;
                }
              card:
                cards:
                  - type: iframe
                    url: http://192.168.1.104/Dashboard
                    aspect: 100%
                type: horizontal-stack
            deviceID:
              - this
            title: UnRAID Server

@thomasloven
Copy link
Owner

thomasloven commented Jul 24, 2020

Try:

style: |
  :host .content {
    width: 90vw;
    height 90 vh;
  }

@thomasloven
Copy link
Owner

Here's some styles for setting height and width, making a transparent background and setting a border radius

style:
  $: |
    .mdc-dialog .mdc-dialog__container .mdc-dialog__surface {
      border-radius: 25px;
    }
  .: |
    :host {
      --mdc-theme-surface: rgba(0,0,0,0);
      --secondary-background-color: rgba(0,0,0,0.5);
      --ha-card-background: rgba(0,0,0,0.5);
    }
    :host .content {
      width: 90vw;
      height: 90vh;
     }

@thomasloven thomasloven pinned this issue Jul 24, 2020
@basesnow
Copy link
Author

OK, I spoke a little too soon. Pop ups work fine on my fire tablet using fully kiosk. But they don't show up at all now on my iPhone running the HA companion app, or in safari on my Mac. I restarted HA and cleared my cache in the app and in safari, but no luck. The pop ups would show up in 1.1.0, but the styling was messed up. Now I am getting nothing running 1.1.2

@thomasloven
Copy link
Owner

Oh look. Yet another javascript function that safari just doesn't support... I swear it's the IE6 of the 20teens...

I know what the problem is, but won't have time to fix it for a few hours.

@thomasloven
Copy link
Owner

Should work now

@UmbeMont
Copy link

UmbeMont commented Jul 25, 2020

Hi , same problem , popup mac & iphone not showing any popup , i hold the button , but nothing come out.

image

@thomasloven
Copy link
Owner

After updating to 1.1.3, try adding ?whatever to the end of the resource URL and do a hard refresh.

@UmbeMont
Copy link

UmbeMont commented Jul 27, 2020

i do not have browser mod in resources , i only use card mod and i do not have updates available.
1.1.3 version is browser mod ? i updated the version overwrighting the folder , restarted , but still no popups.

@thomasloven
Copy link
Owner

Oh! Silly me. Of course. Sorry about that.

@UmbeMont
Copy link

UmbeMont commented Jul 28, 2020

Updated just now browser mod folder , restarted and all good but....
The only problem now is when you go on settings , it does not open anymore the setting of the light
Thanks a lot!

image

image

@ASNNetworks
Copy link

Updated just now browser mod folder , restarted and all good but....

The only problem now is when you go on settings , it does not open anymore the setting of the light

Thanks a lot!

image image

That has nothing to do with browser mod, but light-pop-card you use. It has been updated and no longer shows settings. You need to envoke a custom card now. See this for more information.

@Protoncek
Copy link

Protoncek commented Oct 24, 2021

Hello!
I'm struggling with styles on simple pop-up card:

service: browser_mod.popup
data:
  title: WARNING!
  deviceID:
    - af7829a2-c1e89390
  large: false
  time: 20
  card:
    type: markdown
    content: This is the warning!
    card_mod:
      style: |
       ha-card {
          background: red;
          color: white;
        }
    

whatever style i put at the end, styling is not applied (i also tried :host).
Any suggestions how to make this popup with, say, red background and white text?

What i'm trying to do is show popup from automation when certain condition is met.

EDIT: solved. I restarted my PC and for unknown reason above code start to work...

@NR3Y
Copy link

NR3Y commented Mar 30, 2023

Hmmm, I'm having a similar issue (styles not being applied).

I have created an automation that throws up a pop-up card when a device changes state. (In this example, a light coming on, but the code is a placeholder for a freezer door being open, when I get around to purchasing the appropriate hardware.)

Trigger (in this case) the light does in fact bring up a popup card, but none of the requested styles are applied.

If anyone has any brilliant suggestions, I'd much appreciate it.

Code from my automation script:

  • id: '1680206256594'
    alias: Test Popup for Light
    description: Tests Popup if Light Comes On
    trigger:
    • platform: state
      entity_id:
      • light.landing
        from: 'off'
        to: 'on'
        condition: []
        action:
    • service: browser_mod.popup
      data:
      dismissable: true
      autoclose: false
      content:
      type: custom:popup-card
      entity: light.upstairs_alcove
      title: ACTION NEEDED
      card:
      type: markdown
      style: |
      ha-card {
      color: red;
      width: 100%;
      height: 100%;
      background-color: #3C4048;
      text-align: center;
      padding-top: 0px;
      font-size: 30px;
      }
      content: Alcove Light is On
      size: normal
      mode: single

@nochlab1
Copy link

Hmmm, I'm having a similar issue (styles not being applied).

I have created an automation that throws up a pop-up card when a device changes state. (In this example, a light coming on, but the code is a placeholder for a freezer door being open, when I get around to purchasing the appropriate hardware.)

Trigger (in this case) the light does in fact bring up a popup card, but none of the requested styles are applied.

If anyone has any brilliant suggestions, I'd much appreciate it.

Code from my automation script:

  • id: '1680206256594'
    alias: Test Popup for Light
    description: Tests Popup if Light Comes On
    trigger:

    • platform: state
      entity_id:

      • light.landing
        from: 'off'
        to: 'on'
        condition: []
        action:
    • service: browser_mod.popup
      data:
      dismissable: true
      autoclose: false
      content:
      type: custom:popup-card
      entity: light.upstairs_alcove
      title: ACTION NEEDED
      card:
      type: markdown
      style: |
      ha-card {
      color: red;
      width: 100%;
      height: 100%;
      background-color: #3C4048;
      text-align: center;
      padding-top: 0px;
      font-size: 30px;
      }
      content: Alcove Light is On
      size: normal
      mode: single

Hi did you figure it out?

@NR3Y
Copy link

NR3Y commented Jan 23, 2024 via email

@hheimbuerger
Copy link

hheimbuerger commented Jun 12, 2024

(EDIT: I had added my request here, because it specifically refers to a comment above. But it doesn't really belong on this issue, so I opened a new one for it: #714)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants