MDL-51821 forms: Be more explicit in autocomplete if no suggestions

This commit is contained in:
Damyon Wiese 2015-10-19 14:20:20 +08:00
parent bdd60287e5
commit 81c471e2a9
3 changed files with 7 additions and 6 deletions

View File

@ -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';

File diff suppressed because one or more lines are too long

View File

@ -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);