Disabled arrow-key navigation while displaying replies modal

This commit is contained in:
Alvaro 2022-09-28 10:26:46 -06:00 committed by GitHub
parent a9af4ca3ee
commit 0c120eaf3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -342,6 +342,12 @@ export const StoryViewer = ({
const navigateStories = useCallback(
(ev: KeyboardEvent) => {
// the replies modal can consume arrow keys
// we don't want to navigate while someone is typing a reply
if (hasStoryViewsNRepliesModal) {
return;
}
if (canNavigateRight && ev.key === 'ArrowRight') {
viewStory({
storyId: story.messageId,
@ -361,6 +367,7 @@ export const StoryViewer = ({
}
},
[
hasStoryViewsNRepliesModal,
canNavigateLeft,
canNavigateRight,
story.messageId,