-
Bug
-
Resolution: Fixed
-
Minor
-
4.0.4
-
MOODLE_400_STABLE
-
MOODLE_311_STABLE, MOODLE_400_STABLE
-
MDL-75834-master -
There is a bug in the JavaScript event handler for focus lock. This code is supposed to handle the case where the locked region no longer exists, by removing the focus lock. However, it then continues to process the following code, which requires a locked region in order to work, instead of exiting.
This can be reproduced in the activity settings screen using the following sequence (tested in Moodle 4.0.4 and current master):
- Edit any activity, e.g. a Page. Or create a new one.
- Expand the Restrict access fieldset. The activity should not have any current restrictions.
- Click Add restriction...
- Turn on the browser's developer tools and clear the console.
- Click Date
Visually it appears to work, but a JavaScript error appears in the console:
'Uncaught TypeError: lockRegion is undefined'
This occurs in function focusFirstDescendant; the source file for this is focuslock.js.
Note: I think the reason that the lock region wasn't unlocked is that the 'Add restriction' dialog is not hidden (which would trigger a visibility change event and remove the focus lock as a result) but only destroyed. This might be a bug in the dialog code (i.e. destroying the dialog should also remove focus lock) but let's deal with one bug at a time, and I'm more confident about how to fix this one.