fix autocomplete not hiding issue

This commit is contained in:
Yuri Kuznetsov
2023-12-05 12:52:07 +02:00
parent d59b598234
commit 13b43d1bfa
3 changed files with 19 additions and 0 deletions
@@ -219,6 +219,13 @@ function (Dep, From, EmailAddress) {
autoSelectFirst: true,
noCache: true,
triggerSelectOnValidInput: false,
beforeRender: () => {
// Prevent an issue that suggestions are shown and not hidden
// when clicking outside the window and then focusing back on the document.
if (this.$input.get(0) !== document.activeElement) {
setTimeout(() => this.$input.autocomplete('hide'), 30);
}
},
formatResult: (suggestion) => {
return this.getHelper().escapeString(suggestion.name) + ' <' +
this.getHelper().escapeString(suggestion.id) + '>';
+6
View File
@@ -529,6 +529,12 @@ class LinkMultipleFieldView extends BaseFieldView {
if (this.$element.hasClass('input-sm')) {
$c.addClass('small');
}
// Prevent an issue that suggestions are shown and not hidden
// when clicking outside the window and then focusing back on the document.
if (this.$element.get(0) !== document.activeElement) {
setTimeout(() => this.$element.autocomplete('hide'), 30);
}
},
formatResult: suggestion => {
// noinspection JSUnresolvedReference
+6
View File
@@ -608,6 +608,12 @@ class LinkFieldView extends BaseFieldView {
if (this.$elementName.hasClass('input-sm')) {
$c.addClass('small');
}
// Prevent an issue that suggestions are shown and not hidden
// when clicking outside the window and then focusing back on the document.
if (this.$elementName.get(0) !== document.activeElement) {
setTimeout(() => this.$elementName.autocomplete('hide'), 30);
}
},
lookup: (q, callback) => {
if (!this.autocompleteOnEmpty && q.length === 0) {