mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-25 00:20:57 -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();
|
||||
|
||||
useEffect(() => {
|
||||
function keyUp(event: KeyboardEvent) {
|
||||
function keyDown(event: KeyboardEvent) {
|
||||
if (event.key === "Escape") {
|
||||
modalController.pop("close");
|
||||
} else if (event.key === "Enter") {
|
||||
|
@ -18,8 +18,8 @@ export default observer(() => {
|
|||
}
|
||||
}
|
||||
|
||||
document.addEventListener("keyup", keyUp);
|
||||
return () => document.removeEventListener("keyup", keyUp);
|
||||
document.addEventListener("keydown", keyDown);
|
||||
return () => document.removeEventListener("keydown", keyDown);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in a new issue