mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 04:33:13 +01:00
MDL-63198 forms: click on scrollbar should not close the suggestions box
This commit is contained in:
parent
f622ee97e3
commit
e75bf41538
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
@ -719,10 +719,13 @@ function($, log, str, templates, notification, LoadingIcon) {
|
||||
// Get the current element with focus.
|
||||
var focusElement = $(document.activeElement);
|
||||
|
||||
// Only close the menu if the input hasn't regained focus, and if the element still exists.
|
||||
// Only close the menu if the input hasn't regained focus and if the element still exists,
|
||||
// and regain focus if the scrollbar is clicked.
|
||||
// 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 (focusElement.is(document.getElementById(state.suggestionsId))) {
|
||||
inputElement.focus(); // Probably the scrollbar is clicked. Regain focus.
|
||||
} else if (!focusElement.is(inputElement) && $(document.getElementById(state.inputId)).length) {
|
||||
if (options.tags) {
|
||||
pendingPromise.then(function() {
|
||||
return createItem(options, state, originalSelect);
|
||||
|
@ -35,7 +35,7 @@
|
||||
{ "label": "Another item label with <strong>tags</strong>", "value": "4" }
|
||||
]}
|
||||
}}
|
||||
<ul class="form-autocomplete-suggestions" id="{{suggestionsId}}" role="listbox" aria-hidden="true">
|
||||
<ul class="form-autocomplete-suggestions" id="{{suggestionsId}}" role="listbox" aria-hidden="true" tabindex="-1">
|
||||
{{#options}}
|
||||
<li role="option" data-value="{{value}}">{{{label}}}</li>
|
||||
{{/options}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user