Skip to content

feat: add keyboard shortcuts to screenshot review page#250

Open
tim-richter wants to merge 2 commits into
mainfrom
claude/adoring-planck-u6yVS
Open

feat: add keyboard shortcuts to screenshot review page#250
tim-richter wants to merge 2 commits into
mainfrom
claude/adoring-planck-u6yVS

Conversation

@tim-richter

Copy link
Copy Markdown
Owner

Summary

Add keyboard shortcuts to the screenshot review page for improved navigation and approval workflow. Users can now use arrow keys to navigate between screenshots and the 'a' key to approve the current screenshot.

Changes

  • ScreenshotViewer component: Added useEffect hook to listen for keyboard events with smart filtering (ignores modifier keys, content-editable elements, and form inputs)
    • ArrowLeft: Navigate to previous screenshot (if available)
    • ArrowRight: Navigate to next screenshot (if available)
    • a: Approve current screenshot (if not already approved)
  • Tests: Added three new test cases covering all keyboard shortcut scenarios
    • Navigation via ArrowRight
    • Navigation via ArrowLeft
    • Approval via 'a' key with API verification
  • Documentation: Updated CLI docs to document the new keyboard shortcuts with visual kbd elements
  • Changeset: Added entry documenting the feature as a minor version bump for @cappa/server

Implementation Details

  • Keyboard handler respects common UX patterns: ignores events when modifier keys are held, when focus is on form inputs, or when editing content
  • Uses useNavigate from react-router to handle screenshot navigation
  • Properly cleans up event listener on component unmount
  • Dependencies array includes all necessary values to ensure handler has access to current screenshot state

https://claude.ai/code/session_01KBiQotWVr35kYHJWVUN3C3

…roval

Adds ArrowLeft/ArrowRight to navigate between screenshots and 'a' to
approve the current screenshot when on the review page.
@changeset-bot

changeset-bot Bot commented May 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8f5cdaf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@cappa/server Minor
@cappa/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

userEvent.keyboard in vitest browser mode routes through playwright's
keyboard.down/insertText which doesn't reliably trigger window-level
keydown listeners. Dispatch a real KeyboardEvent on window so the tests
exercise the actual handler.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants