From 9f10bc1371046468890989f8520c57911997a591 Mon Sep 17 00:00:00 2001 From: Tom Carpenter Date: Fri, 13 Feb 2026 13:02:16 +0000 Subject: [PATCH] Correct value update for 'ha-selector-select' elements displaying as radio buttons. (#29612) * Correct options reset in ha-selector-select Separate out the handling of resetting for select elements in `ha-selector-select` from the main value changed callback. This fixes a bug that prevented `ha-selector-select` elements operating in `list` mode from updating their value due to recent changes in the reset logc. * Split radio changed callback for consistency --- src/components/ha-selector/ha-selector-select.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/ha-selector/ha-selector-select.ts b/src/components/ha-selector/ha-selector-select.ts index 8ca3a10f6c..c3bdf82a41 100644 --- a/src/components/ha-selector/ha-selector-select.ts +++ b/src/components/ha-selector/ha-selector-select.ts @@ -93,7 +93,7 @@ export class HaSelectSelector extends LitElement { @@ -120,7 +120,7 @@ export class HaSelectSelector extends LitElement { .checked=${item.value === this.value} .value=${item.value} .disabled=${item.disabled || this.disabled} - @change=${this._valueChanged} + @change=${this._radioChanged} > ` @@ -236,7 +236,7 @@ export class HaSelectSelector extends LitElement { .disabled=${this.disabled} .required=${this.required} clearable - @selected=${this._valueChanged} + @selected=${this._selectChanged} .options=${options} > @@ -282,16 +282,24 @@ export class HaSelectSelector extends LitElement { ); } - private _valueChanged(ev) { + private _radioChanged(ev) { ev.stopPropagation(); + this._valueChanged(ev); + } + private _selectChanged(ev) { + ev.stopPropagation(); + // Additional handling for reset of select elements if (ev.detail?.value === undefined && this.value !== undefined) { fireEvent(this, "value-changed", { value: undefined, }); return; } + this._valueChanged(ev); + } + private _valueChanged(ev) { const value = ev.detail?.value || ev.target.value; if (this.disabled || value === undefined || value === (this.value ?? "")) { return;