From fae3bd0a0fb3f74f8fad9661cd123e91ac9fa908 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 27 Dec 2023 13:35:28 +0100 Subject: [PATCH] Only focus search when not in fullscreen dialog --- .../add-automation-element-dialog.ts | 24 +++++++++---------- .../integrations/dialog-add-integration.ts | 18 +++++++------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/panels/config/automation/add-automation-element-dialog.ts b/src/panels/config/automation/add-automation-element-dialog.ts index 097a00ca27a0..6c830976c54f 100644 --- a/src/panels/config/automation/add-automation-element-dialog.ts +++ b/src/panels/config/automation/add-automation-element-dialog.ts @@ -3,9 +3,10 @@ import { mdiClose, mdiContentPaste, mdiPlus } from "@mdi/js"; import Fuse, { IFuseOptions } from "fuse.js"; import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; +import { ifDefined } from "lit/directives/if-defined"; import { repeat } from "lit/directives/repeat"; -import memoizeOne from "memoize-one"; import { styleMap } from "lit/directives/style-map"; +import memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; import { domainIcon } from "../../../common/entity/domain_icon"; import { shouldHandleRequestSelectedEvent } from "../../../common/mwc/handle-request-selected-event"; @@ -13,7 +14,7 @@ import { stringCompare } from "../../../common/string/compare"; import { LocalizeFunc } from "../../../common/translations/localize"; import "../../../components/ha-dialog"; import type { HaDialog } from "../../../components/ha-dialog"; -import "../../../components/ha-header-bar"; +import "../../../components/ha-dialog-header"; import "../../../components/ha-icon-button"; import "../../../components/ha-icon-button-prev"; import "../../../components/ha-icon-next"; @@ -94,6 +95,8 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { @query("ha-dialog") private _dialog?: HaDialog; + private _fullScreen = false; + private _width?: number; private _height?: number; @@ -105,6 +108,9 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { this.hass.loadBackendTranslation("services"); this._fetchManifests(); } + this._fullScreen = matchMedia( + "all and (max-width: 450px), all and (max-height: 500px)" + ).matches; } public closeDialog(): void { @@ -406,7 +412,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { .heading=${true} >
- + ${this._group ? groupName @@ -424,10 +430,9 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { slot="navigationIcon" dialogAction="cancel" >`} - +
${integrations - ? html` + ? html`