Fix combobox picking first item with label on blur (#17701)

This commit is contained in:
Bram Kragten 2023-08-24 22:22:26 +02:00 committed by GitHub
parent a08a989ef5
commit 66e0100c95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -324,6 +324,7 @@ export class HaDevicePicker extends SubscribeMixin(LitElement) {
.renderer=${rowRenderer}
.disabled=${this.disabled}
.required=${this.required}
item-id-path="id"
item-value-path="id"
item-label-path="name"
@opened-changed=${this._openedChanged}

View File

@ -312,6 +312,10 @@ export class HaComboBox extends LitElement {
private _valueChanged(ev: ComboBoxLightValueChangedEvent) {
ev.stopPropagation();
if (!this.allowCustomValue) {
// @ts-ignore
this._comboBox._closeOnBlurIsPrevented = true;
}
const newValue = ev.detail.value;
if (newValue !== this.value) {