same but for js

This commit is contained in:
Joachim 2021-12-17 20:53:06 +01:00
parent b15e0e37fc
commit 89713ce685

View file

@ -507,8 +507,10 @@ let BookWyrm = new class {
menuElement.querySelectorAll(
'a[href]:not([disabled]), button:not([disabled])'
)[0].focus();
// Enable focus trap
menuElement.addEventListener('keydown', this.handleFocusTrap);
// Close on Esc
detailsElement.addEventListener('keydown', handleEscKey);
@ -518,6 +520,7 @@ let BookWyrm = new class {
}
} else {
summaryElement.focus();
// Disable focus trap
menuElement.removeEventListener('keydown', this.handleFocusTrap);