Skip to content

Commit 6114283

Browse files
committed
Completer.js: Trigger autosubmit when no suggestion is selected and completer isn’t in term input
Ensure the form submits automatically when: - The completer is not part of term input or instrumented - The completer has the autosubmit dataset attribute - No suggestion is explicitly selected
1 parent 01b4082 commit 6114283

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

asset/js/widget/Completer.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,13 @@ define(["../notjQuery"], function ($) {
498498
}
499499

500500
this.hideSuggestions();
501+
502+
// Autosubmit when user leaves without selecting a suggestion.
503+
// Only for non-instrumented mode — instrumented inputs (e.g. TermInput) handle
504+
// autosubmit themselves via BaseInput.autoSubmit() with proper term data.
505+
if (! this.instrumented && this.shouldAutoSubmit()) {
506+
$(completedInput.form).trigger('submit', { submittedBy: completedInput });
507+
}
501508
}
502509
}, 250);
503510
}

0 commit comments

Comments
 (0)