Skip to content

Commit 31bf2fb

Browse files
committed
fix: autosubmit only if the suggestion is closed
1 parent ee71399 commit 31bf2fb

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

asset/js/widget/Completer.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -478,18 +478,18 @@ define(["../notjQuery"], function ($) {
478478
}
479479

480480
onFocusOut(event) {
481-
// Autosubmit when the user leaves the input without selecting a suggestion on manually changing the value.
482-
// Only for non-instrumented mode — instrumented inputs (e.g. TermInput) handle
483-
// autosubmit themselves via BaseInput.autoSubmit() with proper term data.
484-
if (! this.instrumented && this.hasBeenManuallyChanged && this.shouldAutoSubmit()) {
485-
this.hasBeenManuallyChanged = false;
486-
let input = event.target;
487-
setTimeout(() => {
488-
$(input.form).trigger('submit', { submittedBy: input });
489-
}, 250);
490-
}
491-
492481
if (this.completedInput === null) {
482+
// Autosubmit if the user leaves the input.
483+
// Only for non-instrumented mode — instrumented inputs (e.g. TermInput) handle
484+
// autosubmit themselves via BaseInput.autoSubmit() with proper term data.
485+
if (! this.instrumented && this.hasBeenManuallyChanged && this.shouldAutoSubmit()) {
486+
this.hasBeenManuallyChanged = false;
487+
let input = event.target;
488+
setTimeout(() => {
489+
$(input.form).trigger('submit', { submittedBy: input });
490+
}, 250);
491+
}
492+
493493
// If there are multiple instances of Completer bound to the same suggestion container
494494
// all of them try to handle the event. Though, only one of them is responsible and
495495
// that's the one which has a completed input set.

0 commit comments

Comments
 (0)