Merge branch 'MDL-65102-35' of git://github.com/rezaies/moodle into MOODLE_35_STABLE
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
@@ -696,14 +696,27 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
}
|
||||
return true;
|
||||
});
|
||||
// Support submitting the form without leaving the autocomplete element,
|
||||
// or submitting too quick before the blur handler action is completed.
|
||||
inputElement.closest('form').on('submit', function() {
|
||||
if (options.tags) {
|
||||
// If tags are enabled, create a tag.
|
||||
addPendingJSPromise('form-autocomplete-submit')
|
||||
.resolve(createItem(options, state, originalSelect));
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
inputElement.on('blur', function() {
|
||||
var pendingPromise = addPendingJSPromise('form-autocomplete-blur');
|
||||
window.setTimeout(function() {
|
||||
// Get the current element with focus.
|
||||
var focusElement = $(document.activeElement);
|
||||
|
||||
// Only close the menu if the input hasn't regained focus.
|
||||
if (focusElement.attr('id') != inputElement.attr('id')) {
|
||||
// Only close the menu if the input hasn't regained focus, and if the element still exists.
|
||||
// Due to the half a second delay, it is possible that the input element no longer exist
|
||||
// by the time this code is being executed.
|
||||
if (focusElement.attr('id') != inputElement.attr('id') && $('#' + state.inputId).length) {
|
||||
if (options.tags) {
|
||||
pendingPromise.then(function() {
|
||||
return createItem(options, state, originalSelect);
|
||||
|
||||
Reference in New Issue
Block a user