forked from mirrors/bookwyrm
same but for js
This commit is contained in:
parent
b15e0e37fc
commit
89713ce685
1 changed files with 3 additions and 0 deletions
|
@ -507,8 +507,10 @@ let BookWyrm = new class {
|
||||||
menuElement.querySelectorAll(
|
menuElement.querySelectorAll(
|
||||||
'a[href]:not([disabled]), button:not([disabled])'
|
'a[href]:not([disabled]), button:not([disabled])'
|
||||||
)[0].focus();
|
)[0].focus();
|
||||||
|
|
||||||
// Enable focus trap
|
// Enable focus trap
|
||||||
menuElement.addEventListener('keydown', this.handleFocusTrap);
|
menuElement.addEventListener('keydown', this.handleFocusTrap);
|
||||||
|
|
||||||
// Close on Esc
|
// Close on Esc
|
||||||
detailsElement.addEventListener('keydown', handleEscKey);
|
detailsElement.addEventListener('keydown', handleEscKey);
|
||||||
|
|
||||||
|
@ -518,6 +520,7 @@ let BookWyrm = new class {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
summaryElement.focus();
|
summaryElement.focus();
|
||||||
|
|
||||||
// Disable focus trap
|
// Disable focus trap
|
||||||
menuElement.removeEventListener('keydown', this.handleFocusTrap);
|
menuElement.removeEventListener('keydown', this.handleFocusTrap);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue