static: close modal on escape key
This commit is contained in:
parent
12f211d07d
commit
b555c151dc
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -25,6 +25,15 @@ export class ModalButton extends LitElement {
|
||||||
return [ModalBoxStyle, BullseyeStyle, BackdropStyle]
|
return [ModalBoxStyle, BullseyeStyle, BackdropStyle]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
window.addEventListener("keyup", e => {
|
||||||
|
if (e.code === "Escape") {
|
||||||
|
this.open = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
setContent(content: string) {
|
setContent(content: string) {
|
||||||
this.querySelector("[slot=modal]")!.innerHTML = content;
|
this.querySelector("[slot=modal]")!.innerHTML = content;
|
||||||
// Ensure links close the modal
|
// Ensure links close the modal
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import "./legacy.js";
|
import "./legacy.js";
|
||||||
|
|
||||||
import "./AdminLoginsChart";
|
|
||||||
import './AdminSidebar';
|
|
||||||
import './ActionButton';
|
import './ActionButton';
|
||||||
|
import './AdminSidebar';
|
||||||
|
import './AdminSiteShell';
|
||||||
|
import "./AdminLoginsChart";
|
||||||
import './Dropdown';
|
import './Dropdown';
|
||||||
import './FetchFillSlot';
|
import './FetchFillSlot';
|
||||||
import './FlowShellCard';
|
import './FlowShellCard';
|
||||||
import './Messages';
|
import './Messages';
|
||||||
import './Tabs';
|
|
||||||
import './ModalButton';
|
import './ModalButton';
|
||||||
import './AdminSiteShell';
|
import './Tabs';
|
||||||
|
|
Reference in New Issue