Skip to content

EspoCRM – Open Source CRM Application

Fix search suggestion autocomplete focus not handled

Yurii6be7ca26e775
diff --git a/client/src/views/record/search.ts b/client/src/views/record/search.ts
index 1e5142212c..509a287e6b 100644
--- a/client/src/views/record/search.ts
+++ b/client/src/views/record/search.ts
@@ -879,11 +879,21 @@ class SearchView extends View<ViewSchema> {
autocomplete.hide();
// 200 is hardcoded in autocomplete lib.
- setTimeout(() => this.textFilterInputElement?.focus(), 201);
+ setTimeout(() => {
+ if (this.textFilterInputElement && document.activeElement === this.textFilterInputElement) {
+ $(this.textFilterInputElement).triggerHandler('focus.autocomplete');
+
+ return;
+ }
+
+ this.textFilterInputElement?.focus();
+ }, 201);
});
},
});
+ this.textFilterInputElement.addEventListener('focus', () => console.log('native focus'));
+
this.once('render remove', () => autocomplete.dispose());
}