Skip to content

Commit

Permalink
Merge pull request #444 from allen-cell-animated/fix/arrow-key-input
Browse files Browse the repository at this point in the history
fix: Arrow keys no longer advance time when focused on an input
  • Loading branch information
ShrimpCryptid authored Sep 30, 2024
2 parents 0eeee38 + be05987 commit e97fa10
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -688,10 +688,13 @@ function Viewer(): ReactElement {
timeControls.setFrameCallback(setFrame);

const handleKeyDown = useCallback(
({ key }: KeyboardEvent): void => {
if (key === "ArrowLeft" || key === "Left") {
(e: KeyboardEvent): void => {
if (e.target instanceof HTMLInputElement) {
return;
}
if (e.key === "ArrowLeft" || e.key === "Left") {
timeControls.advanceFrame(-1);
} else if (key === "ArrowRight" || key === "Right") {
} else if (e.key === "ArrowRight" || e.key === "Right") {
timeControls.advanceFrame(1);
}
},
Expand Down

0 comments on commit e97fa10

Please sign in to comment.