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(() => {
|
useEffect(() => {
|
||||||
const handleKeyDown = (e: KeyboardEvent) => {
|
if (!isOpen) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleKeyDown(e: KeyboardEvent) {
|
||||||
switch (e.key) {
|
switch (e.key) {
|
||||||
case 'Left': // IE/Edge specific value
|
case 'Left': // IE/Edge specific value
|
||||||
case 'ArrowLeft':
|
case 'ArrowLeft':
|
||||||
@ -406,14 +410,14 @@ const MediaViewer: FC<StateProps & DispatchProps> = ({
|
|||||||
selectMessage(nextMessageId);
|
selectMessage(nextMessageId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
document.addEventListener('keydown', handleKeyDown, false);
|
document.addEventListener('keydown', handleKeyDown, false);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
document.removeEventListener('keydown', handleKeyDown, false);
|
document.removeEventListener('keydown', handleKeyDown, false);
|
||||||
};
|
};
|
||||||
}, [nextMessageId, previousMessageId, selectMessage]);
|
}, [isOpen, nextMessageId, previousMessageId, selectMessage]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isZoomed || IS_TOUCH_ENV) return undefined;
|
if (isZoomed || IS_TOUCH_ENV) return undefined;
|
||||||
|
Loading…
Reference in New Issue
Block a user