Skip to content

Commit

Permalink
Reset select-selector to undefined when cleared (#20821)
Browse files Browse the repository at this point in the history
  • Loading branch information
karwosts authored May 18, 2024
1 parent 111816f commit 914dbc1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/ha-selector/ha-selector-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,14 @@ export class HaSelectSelector extends LitElement {

private _valueChanged(ev) {
ev.stopPropagation();

if (ev.detail?.index === -1 && this.value !== undefined) {
fireEvent(this, "value-changed", {
value: undefined,
});
return;
}

const value = ev.detail?.value || ev.target.value;
if (this.disabled || value === undefined || value === (this.value ?? "")) {
return;
Expand Down

0 comments on commit 914dbc1

Please sign in to comment.