mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-51821 forms: Be more explicit in autocomplete if no suggestions
This commit is contained in:
parent
bdd60287e5
commit
81c471e2a9
@ -50,6 +50,7 @@ $string['mustbeoverriden'] = 'Abstract form_definition() method in class {$a} mu
|
||||
$string['nomethodforaddinghelpbutton'] = 'There is no method for adding a help button to form element {$a->name} (class {$a->classname})';
|
||||
$string['nonexistentformelements'] = 'Trying to add help buttons to non-existent form elements : {$a}';
|
||||
$string['noselection'] = 'No selection';
|
||||
$string['nosuggestions'] = 'No suggestions';
|
||||
$string['optional'] = 'Optional';
|
||||
$string['othersettings'] = 'Other settings';
|
||||
$string['requiredelement'] = 'Required field';
|
||||
|
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
@ -288,8 +288,8 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
}
|
||||
});
|
||||
// If we found any matches, show the list.
|
||||
inputElement.attr('aria-expanded', true);
|
||||
if (matchingElements) {
|
||||
inputElement.attr('aria-expanded', true);
|
||||
// We only activate the first item in the list if tags is false,
|
||||
// because otherwise "Enter" would select the first item, instead of
|
||||
// creating a new tag.
|
||||
@ -297,10 +297,10 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
activateItem(0, inputId, suggestionsId);
|
||||
}
|
||||
} else {
|
||||
// Abort - nothing matches. Hide the suggestions properly.
|
||||
suggestionsElement.hide();
|
||||
suggestionsElement.attr('aria-hidden', true);
|
||||
inputElement.attr('aria-expanded', false);
|
||||
// Nothing matches. Tell them that.
|
||||
str.get_string('nosuggestions', 'form').done(function(nosuggestionsstr) {
|
||||
suggestionsElement.html(nosuggestionsstr);
|
||||
});
|
||||
}
|
||||
}).fail(notification.exception);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user