mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-08 02:19:43 +00:00
Close dialog when clicked on link (#16690)
This commit is contained in:
@@ -21,6 +21,7 @@ import type { DataEntryFlowStepForm } from "../../data/data_entry_flow";
|
||||
import type { HomeAssistant } from "../../types";
|
||||
import type { FlowConfig } from "./show-dialog-data-entry-flow";
|
||||
import { configFlowContentStyles } from "./styles";
|
||||
import { isNavigationClick } from "../../common/dom/is-navigation-click";
|
||||
|
||||
@customElement("step-flow-form")
|
||||
class StepFlowForm extends LitElement {
|
||||
@@ -47,7 +48,7 @@ class StepFlowForm extends LitElement {
|
||||
|
||||
return html`
|
||||
<h2>${this.flowConfig.renderShowFormStepHeader(this.hass, this.step)}</h2>
|
||||
<div class="content">
|
||||
<div class="content" @click=${this._clickHandler}>
|
||||
${this.flowConfig.renderShowFormStepDescription(this.hass, this.step)}
|
||||
${this._errorMsg
|
||||
? html`<ha-alert alert-type="error">${this._errorMsg}</ha-alert>`
|
||||
@@ -92,6 +93,14 @@ class StepFlowForm extends LitElement {
|
||||
this.addEventListener("keydown", this._handleKeyDown);
|
||||
}
|
||||
|
||||
private _clickHandler(ev: MouseEvent) {
|
||||
if (isNavigationClick(ev, false)) {
|
||||
fireEvent(this, "flow-update", {
|
||||
step: undefined,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private _handleKeyDown = (ev: KeyboardEvent) => {
|
||||
if (ev.key === "Enter") {
|
||||
this._submitStep();
|
||||
|
||||
Reference in New Issue
Block a user