Skip to content

Commit e5cb26c

Browse files
authored
Fix automation add TCA autofocus (#28168)
Fix automation add tca autofocus
1 parent 2896519 commit e5cb26c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/components/ha-wa-dialog.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import "@home-assistant/webawesome/dist/components/dialog/dialog";
2+
import { mdiClose } from "@mdi/js";
13
import { css, html, LitElement } from "lit";
24
import {
35
customElement,
@@ -7,8 +9,6 @@ import {
79
state,
810
} from "lit/decorators";
911
import { ifDefined } from "lit/directives/if-defined";
10-
import { mdiClose } from "@mdi/js";
11-
import "@home-assistant/webawesome/dist/components/dialog/dialog";
1212
import { fireEvent } from "../common/dom/fire_event";
1313
import { haStyleScrollbar } from "../resources/styles";
1414
import type { HomeAssistant } from "../types";
@@ -172,7 +172,9 @@ export class HaWaDialog extends LitElement {
172172

173173
await this.updateComplete;
174174

175-
(this.querySelector("[autofocus]") as HTMLElement | null)?.focus();
175+
requestAnimationFrame(() => {
176+
(this.querySelector("[autofocus]") as HTMLElement | null)?.focus();
177+
});
176178
};
177179

178180
private _handleAfterShow = () => {

0 commit comments

Comments
 (0)