Skip to content

[GOOD FIRST ISSUE]: Add keyboard navigation shortcuts to PDF Document Viewer #16

Description

@Hanu2908

Task summary

When students review question sets or lecture notes in the in-app PDF viewer on desktop, pressing keyboard shortcuts should navigate pages and dismiss overlays without clicking on-screen buttons.

Estimated scope / difficulty

Starter (1 to 2 hours)

Motivation and context

When viewing assignment PDFs or lecture documents on desktop/laptop keyboards, students need quick keyboard controls to flip through multi-page documents and close views cleanly.

Relevant files and code pointers

  • src/pages/app/PDFViewerPage.tsx
  • src/components/ImageZoomModal.tsx
  • tests/unit/components.test.tsx

Acceptance criteria

  • ArrowRight and ArrowDown navigate to the next page.
  • ArrowLeft and ArrowUp navigate to the previous page.
  • Escape closes the PDF viewer when open as a modal; when rendered as a standalone page, it navigates back using router history.
  • Keyboard handlers are ignored if an input field, textarea, or child modal is focused.
  • Unit tests added in tests/unit/components.test.tsx verifying keydown event dispatching.
  • npm test and npm run lint pass with 0 errors.

Implementation guide and hints

Look at how window keydown event listeners and cleanup functions are implemented in src/components/ImageZoomModal.tsx. Ensure event listeners are attached on mount and cleaned up on unmount.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions