Disable keyboard navigation if a modal is open in the library

This commit is contained in:
Jackson Harper
2022-04-20 09:33:25 -07:00
parent 5187ad5113
commit 92423eaa0d

View File

@ -236,14 +236,8 @@ export function HomeFeedContainer(props: HomeFeedContainerProps): JSX.Element {
return
}
// If any of the modals are open we disable handling keyboard shortcuts
if (labelsTarget || snoozeTarget || shareTarget) {
return
}
switch (action) {
case 'showDetail':
const username = viewerData?.me?.profile.username
if (username) {
setActiveCardId(item.node.id)
@ -293,6 +287,11 @@ export function HomeFeedContainer(props: HomeFeedContainerProps): JSX.Element {
return gridColumnCount
}
// If any of the modals are open we disable handling keyboard shortcuts
if (labelsTarget || snoozeTarget || shareTarget) {
return
}
switch (action) {
case 'openArticle':
handleCardAction('showDetail', activeItem)