Skip to content

Commit d798400

Browse files
committed
Allow nested more-info from Buttons (standard and custom: button-card).
1 parent 92929c1 commit d798400

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

js/plugin/popups.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from "../helpers";
1212
import { loadHaForm } from "../helpers";
1313

14-
const CLOSE_POPUP_ACTIONS = new Set(["assist", "more-info"]);
14+
const CLOSE_POPUP_ACTIONS = new Set(["assist"]);
1515

1616
class BrowserModPopup extends LitElement {
1717
@property() open;
@@ -527,17 +527,22 @@ export const PopupMixin = (SuperClass) => {
527527
});
528528

529529
this._popupEl.addEventListener("hass-action", async (ev: CustomEvent) => {
530-
if (
531-
(ev.detail.action === "tap" &&
532-
CLOSE_POPUP_ACTIONS.has(ev.detail.config?.tap_action?.action)) ||
533-
(ev.detail.action === "hold" &&
534-
CLOSE_POPUP_ACTIONS.has(ev.detail.config?.hold_action?.action)) ||
535-
(ev.detail.action === "double_tap" &&
536-
CLOSE_POPUP_ACTIONS.has(
537-
ev.detail.config?.double_tap_action?.action
538-
))
539-
) {
540-
this._popupEl.do_close();
530+
const actionType = ev.detail.action;
531+
if (actionType) {
532+
const actionConfig = ev.detail?.config?.[`${actionType}_action`];
533+
if (actionConfig) {
534+
if (actionConfig.action === "more-info") {
535+
ev.stopPropagation();
536+
this.showMoreInfo(
537+
actionConfig.entity,
538+
actionConfig.large ?? false,
539+
actionConfig.ignore_popup_card ?? false,
540+
);
541+
return;
542+
} else if (CLOSE_POPUP_ACTIONS.has(actionConfig.action)){
543+
this._popupEl.do_close();
544+
}
545+
}
541546
}
542547
ev.stopPropagation();
543548
const base = await hass_base_el();

0 commit comments

Comments
 (0)