Merge branch 'MDL-74701-master' of https://github.com/HuongNV13/moodle

This commit is contained in:
Jun Pataleta 2022-06-28 23:51:17 +08:00
commit 9a6d3bb3ba
3 changed files with 17 additions and 2 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

@ -129,6 +129,7 @@ define(['jquery', 'core/str', 'core/custom_interaction_events'],
this.menuContainer.attr('aria-expanded', 'false');
this.menuContainer.attr('aria-hidden', 'true');
this.updateButtonAriaLabel();
this.updateFocusItemTabIndex();
this.root.trigger(this.events().menuClosed);
};
@ -149,6 +150,7 @@ define(['jquery', 'core/str', 'core/custom_interaction_events'],
this.menuContainer.attr('aria-expanded', 'true');
this.menuContainer.attr('aria-hidden', 'false');
this.updateButtonAriaLabel();
this.updateFocusItemTabIndex();
// Resolve the promises to allow the handlers to be added
// to the DOM, if they have been requested.
this.promises.closeHandlers.resolve();
@ -392,5 +394,18 @@ define(['jquery', 'core/str', 'core/custom_interaction_events'],
}.bind(this));
};
/**
* Set the appropriate tabindex attribute on the popover toggle.
*
* @method updateFocusItemTabIndex
*/
PopoverRegionController.prototype.updateFocusItemTabIndex = function() {
if (this.isMenuOpen()) {
this.menuContainer.find(SELECTORS.CAN_RECEIVE_FOCUS).removeAttr('tabindex');
} else {
this.menuContainer.find(SELECTORS.CAN_RECEIVE_FOCUS).attr('tabindex', '-1');
}
};
return PopoverRegionController;
});