mirror of
https://github.com/moodle/moodle.git
synced 2025-08-03 16:13:28 +02:00
MDL-68167 lib: autocomplete focos should not be removed on blur
See https://www.w3.org/TR/wai-aria-practices-1.1/examples/listbox/listbox-rearrangeable.html
This commit is contained in:
parent
e2ee6025fe
commit
0438cd60bb
3 changed files with 10 additions and 13 deletions
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
File diff suppressed because one or more lines are too long
|
@ -812,17 +812,14 @@ function($, log, str, templates, notification, LoadingIcon, Aria) {
|
|||
// Remove it from the selection.
|
||||
pendingPromise.resolve(deselectItem(options, state, $(e.currentTarget), originalSelect));
|
||||
});
|
||||
// Remove the highlight of items when user tabs out the tag list.
|
||||
selectionElement.on('blur', function(e) {
|
||||
e.preventDefault();
|
||||
$(this).children().attr('data-active-selection', false).attr('id', '');
|
||||
});
|
||||
// When tag list is focused, highlight the first item.
|
||||
selectionElement.on('focus', function(e) {
|
||||
e.preventDefault();
|
||||
var element = $(this).children('[data-active-selection=true]');
|
||||
if (element && element.length === 0) {
|
||||
activateNextSelection(state);
|
||||
// When listbox is focused, focus on the first option if there is no focused option.
|
||||
selectionElement.on('focus', function() {
|
||||
// Find the list of selections.
|
||||
var selectionsElement = $(document.getElementById(state.selectionId));
|
||||
// Find the active one.
|
||||
var element = selectionsElement.children('[data-active-selection=true]');
|
||||
if (!element.length) {
|
||||
return activateSelection(0, state);
|
||||
}
|
||||
});
|
||||
// Keyboard navigation for the selection list.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue