Merge branch 'MDL-79337_master' of https://github.com/t-schroeder/moodle

This commit is contained in:
Ilya Tregubov 2023-11-01 13:50:33 +08:00
commit 884efcabd2
No known key found for this signature in database
GPG Key ID: 0F58186F748E55C1
3 changed files with 7 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -284,10 +284,10 @@ export default class Drawers {
}
if (this.drawerNode.classList.contains(CLASSES.SHOW)) {
this.openDrawer({focusOnCloseButton: false});
this.openDrawer({focusOnCloseButton: false, setUserPref: false});
} else if (this.drawerNode.dataset.forceopen == 1) {
if (!isSmall()) {
this.openDrawer({focusOnCloseButton: false});
this.openDrawer({focusOnCloseButton: false, setUserPref: false});
}
} else {
Aria.hide(this.drawerNode);
@ -414,8 +414,9 @@ export default class Drawers {
*
* @param {object} args
* @param {boolean} [args.focusOnCloseButton=true] Whether to alter page focus when opening the drawer
* @param {boolean} [args.setUserPref=true] Whether to store the opened drawer state as a user preference
*/
openDrawer({focusOnCloseButton = true} = {}) {
openDrawer({focusOnCloseButton = true, setUserPref = true} = {}) {
const pendingPromise = new Pending('theme_boost/drawers:open');
const showEvent = this.dispatchEvent(Drawers.eventTypes.drawerShow, true);
@ -439,7 +440,7 @@ export default class Drawers {
this.drawerNode.classList.add(CLASSES.SHOW);
const preference = this.drawerNode.dataset.preference;
if (preference && !isSmall() && (this.drawerNode.dataset.forceopen != 1)) {
if (preference && !isSmall() && (this.drawerNode.dataset.forceopen != 1) && setUserPref) {
setUserPreference(preference, true);
}