mirror of
https://github.com/moodle/moodle.git
synced 2025-04-24 18:04:43 +02:00
MDL-70075 core: jQuery.attr() does not accept a bool value
The documented values that jQuery.attr() accepts are String, Number, or null. For some reason, when we pass a Boolean value, the subsequent click handler does not work in some situations. Changing this to take a Number, and unsetting it when empty, resolves this issue.
This commit is contained in:
parent
189a4c8f8e
commit
5d16bfcf7c
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
@ -69,9 +69,11 @@ function($, log, str, templates, notification, LoadingIcon, Aria) {
|
||||
var itemId = state.selectionId + '-' + index;
|
||||
|
||||
// Deselect all the selections.
|
||||
selectionElement.children().attr('data-active-selection', false).attr('id', '');
|
||||
selectionElement.children().attr('data-active-selection', null).attr('id', '');
|
||||
|
||||
// Select only this suggestion and assign it the id.
|
||||
element.attr('data-active-selection', true).attr('id', itemId);
|
||||
|
||||
// Tell the input field it has a new active descendant so the item is announced.
|
||||
selectionElement.attr('aria-activedescendant', itemId);
|
||||
|
||||
@ -263,7 +265,7 @@ function($, log, str, templates, notification, LoadingIcon, Aria) {
|
||||
// Find the list of selections.
|
||||
var selectionsElement = $(document.getElementById(state.selectionId));
|
||||
// Find the active one.
|
||||
var element = selectionsElement.children('[data-active-selection=true]');
|
||||
var element = selectionsElement.children('[data-active-selection]');
|
||||
if (!element) {
|
||||
return activateSelection(0, state);
|
||||
}
|
||||
@ -286,7 +288,7 @@ function($, log, str, templates, notification, LoadingIcon, Aria) {
|
||||
var selectionsElement = $(document.getElementById(state.selectionId));
|
||||
|
||||
// Find the active one.
|
||||
var element = selectionsElement.children('[data-active-selection=true]');
|
||||
var element = selectionsElement.children('[data-active-selection]');
|
||||
var current = 0;
|
||||
|
||||
if (element) {
|
||||
@ -817,7 +819,7 @@ function($, log, str, templates, notification, LoadingIcon, Aria) {
|
||||
// Find the list of selections.
|
||||
var selectionsElement = $(document.getElementById(state.selectionId));
|
||||
// Find the active one.
|
||||
var element = selectionsElement.children('[data-active-selection=true]');
|
||||
var element = selectionsElement.children('[data-active-selection]');
|
||||
if (!element.length) {
|
||||
return activateSelection(0, state);
|
||||
}
|
||||
@ -845,7 +847,7 @@ function($, log, str, templates, notification, LoadingIcon, Aria) {
|
||||
case KEYS.SPACE:
|
||||
case KEYS.ENTER:
|
||||
// Get the item that is currently selected.
|
||||
var selectedItem = $(document.getElementById(state.selectionId)).children('[data-active-selection=true]');
|
||||
var selectedItem = $(document.getElementById(state.selectionId)).children('[data-active-selection]');
|
||||
if (selectedItem) {
|
||||
e.preventDefault();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user