Trim search inputs (#20825)

This commit is contained in:
Simon Lamon
2024-05-22 10:39:32 +02:00
committed by GitHub
parent ae9e1b724f
commit 2113cf5280
3 changed files with 4 additions and 4 deletions

View File

@@ -407,7 +407,7 @@ export class HaEntityPicker extends LitElement {
private _valueChanged(ev: ValueChangedEvent<string>) {
ev.stopPropagation();
const newValue = ev.detail.value;
const newValue = ev.detail.value.trim();
if (newValue && newValue.startsWith(CREATE_ID)) {
const domain = newValue.substring(CREATE_ID.length);
@@ -427,7 +427,7 @@ export class HaEntityPicker extends LitElement {
private _filterChanged(ev: CustomEvent): void {
const target = ev.target as HaComboBox;
const filterString = ev.detail.value.toLowerCase();
const filterString = ev.detail.value.trim().toLowerCase();
target.filteredItems = filterString.length
? fuzzyFilterSort<HassEntityWithCachedName>(filterString, this._states)
: this._states;