mirror of
https://github.com/danog/telegram-tt.git
synced 2024-11-27 04:45:08 +01:00
Composer: Fix arrow keys reset forwarding
This commit is contained in:
parent
2dc6f738b6
commit
0d48faba2f
@ -394,7 +394,11 @@ const MediaViewer: FC<StateProps & DispatchProps> = ({
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
if (!isOpen) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function handleKeyDown(e: KeyboardEvent) {
|
||||
switch (e.key) {
|
||||
case 'Left': // IE/Edge specific value
|
||||
case 'ArrowLeft':
|
||||
@ -406,14 +410,14 @@ const MediaViewer: FC<StateProps & DispatchProps> = ({
|
||||
selectMessage(nextMessageId);
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
document.addEventListener('keydown', handleKeyDown, false);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener('keydown', handleKeyDown, false);
|
||||
};
|
||||
}, [nextMessageId, previousMessageId, selectMessage]);
|
||||
}, [isOpen, nextMessageId, previousMessageId, selectMessage]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isZoomed || IS_TOUCH_ENV) return undefined;
|
||||
|
Loading…
Reference in New Issue
Block a user