Add stopPropagation to other state-cards

pull/25599/head
Patrick Masters 2025-05-26 11:40:09 -04:00
parent fcf5ed7731
commit 48fa241242
3 changed files with 10 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import type { HassEntity } from "home-assistant-js-websocket";
import type { TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import { stopPropagation } from "../common/dom/stop_propagation";
import { debounce } from "../common/util/debounce"; import { debounce } from "../common/util/debounce";
import "../components/entity/state-info"; import "../components/entity/state-info";
import "../components/ha-slider"; import "../components/ha-slider";
@ -63,6 +64,7 @@ class StateCardInputNumber extends LitElement {
.max=${Number(this.stateObj.attributes.max)} .max=${Number(this.stateObj.attributes.max)}
.value=${this.stateObj.state} .value=${this.stateObj.state}
@change=${this._selectedValueChanged} @change=${this._selectedValueChanged}
@click=${stopPropagation}
></ha-slider> ></ha-slider>
<span class="state"> <span class="state">
${this.hass.formatEntityState(this.stateObj)} ${this.hass.formatEntityState(this.stateObj)}
@ -81,6 +83,7 @@ class StateCardInputNumber extends LitElement {
.suffix=${this.stateObj.attributes.unit_of_measurement || ""} .suffix=${this.stateObj.attributes.unit_of_measurement || ""}
type="number" type="number"
@change=${this._selectedValueChanged} @change=${this._selectedValueChanged}
@click=${stopPropagation}
> >
</ha-textfield> </ha-textfield>
</div> </div>

View File

@ -2,13 +2,14 @@ import type { HassEntity } from "home-assistant-js-websocket";
import type { CSSResultGroup } from "lit"; import type { CSSResultGroup } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import { stopPropagation } from "../common/dom/stop_propagation";
import { debounce } from "../common/util/debounce";
import "../components/entity/state-info"; import "../components/entity/state-info";
import "../components/ha-slider"; import "../components/ha-slider";
import "../components/ha-textfield"; import "../components/ha-textfield";
import type { HomeAssistant } from "../types";
import { haStyle } from "../resources/styles";
import { isUnavailableState } from "../data/entity"; import { isUnavailableState } from "../data/entity";
import { debounce } from "../common/util/debounce"; import { haStyle } from "../resources/styles";
import type { HomeAssistant } from "../types";
@customElement("state-card-number") @customElement("state-card-number")
class StateCardNumber extends LitElement { class StateCardNumber extends LitElement {
@ -66,6 +67,7 @@ class StateCardNumber extends LitElement {
.max=${Number(this.stateObj.attributes.max)} .max=${Number(this.stateObj.attributes.max)}
.value=${this.stateObj.state} .value=${this.stateObj.state}
@change=${this._selectedValueChanged} @change=${this._selectedValueChanged}
@click=${stopPropagation}
> >
</ha-slider> </ha-slider>
<span class="state"> <span class="state">
@ -84,6 +86,7 @@ class StateCardNumber extends LitElement {
.suffix=${this.stateObj.attributes.unit_of_measurement || ""} .suffix=${this.stateObj.attributes.unit_of_measurement || ""}
type="number" type="number"
@change=${this._selectedValueChanged} @change=${this._selectedValueChanged}
@click=${stopPropagation}
> >
</ha-textfield> </ha-textfield>
</div>`} </div>`}

View File

@ -29,6 +29,7 @@ class StateCardSelect extends LitElement {
fixedMenuPosition fixedMenuPosition
@selected=${this._selectedOptionChanged} @selected=${this._selectedOptionChanged}
@closed=${stopPropagation} @closed=${stopPropagation}
@click=${stopPropagation}
> >
${this.stateObj.attributes.options.map( ${this.stateObj.attributes.options.map(
(option) => html` (option) => html`