mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-21 22:50:59 -05:00
fix(modal): trigger on keydown instead of keyup to prevent interference
This commit is contained in:
parent
7d544c82ab
commit
122f047c85
1 changed files with 3 additions and 3 deletions
|
@ -9,7 +9,7 @@ export default observer(() => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function keyUp(event: KeyboardEvent) {
|
function keyDown(event: KeyboardEvent) {
|
||||||
if (event.key === "Escape") {
|
if (event.key === "Escape") {
|
||||||
modalController.pop("close");
|
modalController.pop("close");
|
||||||
} else if (event.key === "Enter") {
|
} else if (event.key === "Enter") {
|
||||||
|
@ -18,8 +18,8 @@ export default observer(() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("keyup", keyUp);
|
document.addEventListener("keydown", keyDown);
|
||||||
return () => document.removeEventListener("keyup", keyUp);
|
return () => document.removeEventListener("keydown", keyDown);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in a new issue