mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
MDL-59527 forms: Race cond with ajax autocomplete
Sometimes (rarely) the auto complete will show "No suggestions" when there are valid suggestions.
This commit is contained in:
parent
350700bf8b
commit
47dd535097
2
lib/amd/build/form-autocomplete.min.js
vendored
2
lib/amd/build/form-autocomplete.min.js
vendored
File diff suppressed because one or more lines are too long
@ -536,7 +536,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
updateAjax(e, options, state, originalSelect, ajaxHandler);
|
||||
});
|
||||
} else {
|
||||
// Else - open the suggestions list.
|
||||
// Open the suggestions list.
|
||||
updateSuggestions(options, state, inputElement.val(), originalSelect);
|
||||
}
|
||||
}
|
||||
@ -613,11 +613,18 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
});
|
||||
if (options.showSuggestions) {
|
||||
var arrowElement = $(document.getElementById(state.downArrowId));
|
||||
arrowElement.on('click', function() {
|
||||
arrowElement.on('click', function(e) {
|
||||
// Prevent the close timer, or we will open, then close the suggestions.
|
||||
inputElement.focus();
|
||||
// Show the suggestions list.
|
||||
updateSuggestions(options, state, inputElement.val(), originalSelect);
|
||||
// Handle ajax population of suggestions.
|
||||
if (!inputElement.val() && options.ajax) {
|
||||
require([options.ajax], function(ajaxHandler) {
|
||||
updateAjax(e, options, state, originalSelect, ajaxHandler);
|
||||
});
|
||||
} else {
|
||||
// Else - open the suggestions list.
|
||||
updateSuggestions(options, state, inputElement.val(), originalSelect);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user