Ensure that there is always one active element in the list of selected
autocomplete elements.
Without this we have issues beacuse clicking on the link makes the first
one active if one is not already active, and this turns a click event
into a drag event, which means that it is not deleted.
Returning a value of `false` in an event handler has the effect of
calling event.preventDefault() and event.stopPropagation().
This is neither obvious, nor desirable in this situation.
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.
The accessibleChange custom interaction event was only listening for
blur and focus, however some OS/browser combinations do not emit these
events until the element is explicitly blurred. This is notably
different on Firefox on some Operating Systems.
Recent changes in MDL-68167 explicitly moved the user participants page
filter module to use the accessibleChange event, which means that the
selections are now only triggered on an explicit blur when using
Firefox. This highlight a bug whereby, when the mouse is used to make a
selection, the event is not triggered until the element is blurred.
This change modifies the accessibleChange event to ignore the `change`
event where it was triggered by the keyboard and where that keybaord
event was not a [return] or [escape] keypress, but to otherwise respect
the native change event.
The `blur` event does not bubble, but the `focusout` events are not
available in all supported versions of Firefox.
Rather than switching event, this patch using event capture to
effectively achieve the same result and bubble the event up through the
DOM to the delegated listener.
There should be no functional change with this patch, except to support
Firefox fully.
It was preventing JS click event handlers being reached on some
elements, such as course admin items in Classic
(eg download course content for teachers).
With this change the modal can be configured to be scrollable or not.
If enabled to be 'scrollable', the modal's body will become scrollable
when the modal's height exceeds the browser's height. This is useful
in cases where the content in the modal is quite large and extends the
modal beyond the browser's height, which usually results in a bad UI.
If 'scrollable' is not explicitely configured, it will be set as 'true'
by default as in most cases it would be the expected behaviour.
Some browsers like Firefox are very inflexible with window.open()
and block it if it is not instantly invoked after the user click.
Also according to https://stackoverflow.com/a/6807615 it is best
practice to replace self:: with static::
With the templaterev issue resolved we should enable the prefetch module
when cachejs is enabled to avoid a different experience when cachejs is
enabled vs. disabled.
Previously there was little point in doing this due to a range of other
bugs (string normalisation, and misuse of templaterev).
With these issues resolved we should enabel the caching.
The M.cfg.templaterev variable should only be used to present persistent
caching, not caching of content within the same page load.
Preventing caching of same-page content makes it difficult to develop
for real user experiences as content is slow to load and does not give a
realistic and consistent loading experience.
This change affects the loading of partials specifically which notably
includes the loading spinner. Without this patch the loading icon is
often not seen at all because it does not load in a timely fashion and
the content being loaded is loaded first.