mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-09 10:59:50 +00:00
Fix device and entity pickers clear (#4206)
* Fix device and entity pickers clear * Prevent combobox to open on clear
This commit is contained in:
committed by
Paulus Schoutsen
parent
8b17b6ed1c
commit
c07b39ebde
@@ -192,8 +192,9 @@ class HaEntityPicker extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
private _clearValue() {
|
||||
this.value = "";
|
||||
private _clearValue(ev: Event) {
|
||||
ev.stopPropagation();
|
||||
this._setValue("");
|
||||
}
|
||||
|
||||
private get _value() {
|
||||
@@ -207,14 +208,18 @@ class HaEntityPicker extends LitElement {
|
||||
private _valueChanged(ev: PolymerChangedEvent<string>) {
|
||||
const newValue = ev.detail.value;
|
||||
if (newValue !== this._value) {
|
||||
this.value = ev.detail.value;
|
||||
setTimeout(() => {
|
||||
fireEvent(this, "value-changed", { value: this.value });
|
||||
fireEvent(this, "change");
|
||||
}, 0);
|
||||
this._setValue(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
private _setValue(value: string) {
|
||||
this.value = value;
|
||||
setTimeout(() => {
|
||||
fireEvent(this, "value-changed", { value });
|
||||
fireEvent(this, "change");
|
||||
}, 0);
|
||||
}
|
||||
|
||||
static get styles(): CSSResult {
|
||||
return css`
|
||||
paper-input > paper-icon-button {
|
||||
|
||||
Reference in New Issue
Block a user