Skip to content

Commit d958a68

Browse files
committed
AO3-6113 hide autocomplete dropdown and cancel search immediately if there's nothing to search for instead
1 parent d34d11c commit d958a68

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

public/javascripts/jquery.tokeninput.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,12 @@ $.TokenList = function (input, url_or_data, settings) {
357357
}
358358
break;
359359
}
360+
})
361+
.keyup(function () {
362+
if ($(this).val().length < settings.minChars) {
363+
hide_dropdown();
364+
clearTimeout(timeout);
365+
}
360366
});
361367

362368
// If the parent form is submitted and there is data in the input box, submit it
@@ -865,11 +871,6 @@ $.TokenList = function (input, url_or_data, settings) {
865871
clearTimeout(timeout);
866872

867873
timeout = setTimeout(function(){
868-
query = input_box.val().toLowerCase();
869-
if (query.length < settings.minChars) {
870-
hide_dropdown();
871-
return;
872-
}
873874
run_search(query);
874875
}, settings.searchDelay);
875876
} else {

public/javascripts/jquery.tokeninput.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)