Fix Esc to close
This commit is contained in:
parent
2f5c7cde58
commit
65e290b160
@ -55,15 +55,16 @@ Last updated: ${lastUpdate} | <a href="https://git.c0ntroller.de/c0ntroller/fron
|
|||||||
}, [projectData, visible]);
|
}, [projectData, visible]);
|
||||||
|
|
||||||
const onEscClose = (e: React.KeyboardEvent) => {
|
const onEscClose = (e: React.KeyboardEvent) => {
|
||||||
|
console.log(e);
|
||||||
if (e.key === "Escape") {
|
if (e.key === "Escape") {
|
||||||
e.preventDefault();
|
//e.preventDefault();
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!visible) return <></>;
|
if (!visible) return <></>;
|
||||||
|
|
||||||
return <div className={styles.modal} onKeyDown={onEscClose}>
|
return <div className={styles.modal}>
|
||||||
<div ref={containerRef} className={`${styles.modalContainer} asciidoc`}>
|
<div ref={containerRef} className={`${styles.modalContainer} asciidoc`}>
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
|
@ -21,7 +21,7 @@ const Home: NextPage = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (<main onKeyDown={hideModalOnEsc}>
|
return (<main onKeyDown={hideModalOnEsc} tabIndex={-1}>
|
||||||
<Head>
|
<Head>
|
||||||
<title>c0ntroller.de</title>
|
<title>c0ntroller.de</title>
|
||||||
</Head>
|
</Head>
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit ef76baafc9a7a3d857ccd5633af2c38debd29251
|
Subproject commit 0496a88b3610ce432d678bf6d2e418f72e537758
|
Loading…
Reference in New Issue
Block a user