-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Summary
Implement keyboard shortcuts for faster flashcard study sessions. Power users and accessibility-focused users benefit significantly from keyboard-driven interactions.
Motivation
- Speed up study sessions by 2-3x for touch typists
- Improve accessibility for users who prefer keyboard navigation
- Standard UX pattern in popular flashcard apps (Anki, Quizlet)
- Reduces friction during review sessions
Proposed Shortcuts
Study Session
| Key | Action |
|---|---|
Space |
Reveal answer / Flip card |
1 |
Rate: Again (forgot) |
2 |
Rate: Hard |
3 |
Rate: Good |
4 |
Rate: Easy |
← / → |
Navigate cards (if applicable) |
Esc |
Exit study session |
Global
| Key | Action |
|---|---|
G then G |
Go to Goals |
G then P |
Go to Progress |
G then S |
Go to Study |
? |
Show keyboard shortcuts help |
Implementation Details
- Create
useKeyboardShortcutshook - Add keyboard event listeners with proper cleanup
- Show visual hints on cards (e.g., "Press Space to reveal")
- Create shortcuts help modal accessible via
? - Ensure shortcuts don't interfere with form inputs
Accessibility Considerations
- Announce actions to screen readers when triggered via keyboard
- Provide visual feedback for key presses
- Don't override browser/OS shortcuts
- Support for custom keybindings (future enhancement)
Technical Approach
function useStudyShortcuts(handlers: {
onReveal: () => void
onRate: (rating: number) => void
}) {
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
if (e.target instanceof HTMLInputElement) return
switch (e.key) {
case ' ': handlers.onReveal(); break
case '1': handlers.onRate(1); break
// ...
}
}
window.addEventListener('keydown', handleKeyDown)
return () => window.removeEventListener('keydown', handleKeyDown)
}, [handlers])
}Acceptance Criteria
- Space bar reveals/flips flashcard
- Number keys 1-4 rate cards
- Shortcuts don't fire when typing in inputs
- Help modal shows all available shortcuts
- Visual hints shown on study cards