Skip to content

Commit d983aea

Browse files
committed
Do not push callback onto the event stack for non-instrumented, non-autosubmit completers
1 parent 58553c1 commit d983aea

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

asset/js/widget/Completer.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -483,22 +483,22 @@ define(["../notjQuery"], function ($) {
483483
}
484484

485485
onFocusOut(event) {
486-
setTimeout(() => {
487-
// Autosubmit if the user leaves the input and the input has been manually changed.
488-
// Only for non-instrumented mode — instrumented inputs (e.g. TermInput) handle
489-
// autosubmit themselves via BaseInput.autoSubmit() with proper term data.
490-
if (
491-
! this.instrumented
492-
&& this.hasBeenManuallyChanged
493-
&& ! this.hasSuggestions()
494-
&& this.shouldAutoSubmit()
495-
) {
496-
// Reset this flag since the user has navigated away from the input and the submit event
497-
// will be triggered by the input's form submit event handler.
498-
this.hasBeenManuallyChanged = false;
499-
$(this.input.form).trigger('submit', {submittedBy: this.input});
500-
}
501-
}, 300);
486+
if (! this.instrumented && this.shouldAutoSubmit()) {
487+
setTimeout(() => {
488+
// Autosubmit if the user leaves the input and the input has been manually changed.
489+
// Only for non-instrumented mode — instrumented inputs (e.g. TermInput) handle
490+
// autosubmit themselves via BaseInput.autoSubmit() with proper term data.
491+
if (
492+
this.hasBeenManuallyChanged
493+
&& ! this.hasSuggestions()
494+
) {
495+
// Reset this flag since the user has navigated away from the input and the submit event
496+
// will be triggered by the input's form submit event handler.
497+
this.hasBeenManuallyChanged = false;
498+
$(this.input.form).trigger('submit', {submittedBy: this.input});
499+
}
500+
}, 300);
501+
}
502502

503503
if (this.completedInput === null) {
504504
// If there are multiple instances of Completer bound to the same suggestion container

0 commit comments

Comments
 (0)