Files
readest/apps/readest-app/.claude/memory/MEMORY.md
T
Huang Xin f361698e05 feat(android): add D-pad navigation for Android TV remote controller (#3745)
* feat(android): add D-pad navigation for Android TV remote controller

Add basic D-pad/arrow key navigation support for Android TV Bluetooth
remote controllers, covering the full flow: library grid browsing,
reader page turning, toolbar interaction, and TTS toggle.

Library:
- Custom spatial navigation hook for grid D-pad navigation
- Arrow keys move between BookshelfItem elements with auto column detection
- ArrowDown from header enters the bookshelf grid

Reader:
- Enter key toggles header/footer toolbar visibility
- Left/Right navigate between toolbar buttons, Up/Down moves between
  header and footer bars
- Back button dismisses toolbar (with blur) before sidebar/library
- Focus-probe technique for reliable button visibility detection
  across fixed/hidden containers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: only auto-focus toolbar buttons on keyboard activation, not mouse hover

Track pointer activity to distinguish keyboard vs mouse toolbar activation.
When the toolbar appears due to mouse hover, skip auto-focus to prevent
unwanted focus outlines on desktop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: track keyboard events instead of pointer events for auto-focus guard

Pointer events from iframes don't bubble to the main document, so
tracking pointermove/pointerdown missed hover interactions over book
content. Track keydown instead — auto-focus only when a recent keyboard
event (Enter key) triggered the toolbar, not mouse hover.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 19:50:34 +02:00

2.1 KiB

Readest Project Memory

Key Reference Documents

Critical Files (Most Bug-Prone)

  • src/utils/style.ts - Central EPUB CSS transformation hub (14+ bug fixes)
  • packages/foliate-js/paginator.js - Page layout, image sizing, backgrounds
  • src/services/tts/TTSController.ts - TTS state machine, section tracking
  • src/hooks/useSafeAreaInsets.ts - Safe area inset management
  • src/app/reader/components/FoliateViewer.tsx - Reader view orchestration
  • src/app/reader/components/annotator/Annotator.tsx - Annotation lifecycle

Feature Notes

  • D-pad Navigation — Android TV remote / keyboard arrow navigation design, key files, and pitfalls

Architecture Notes

  • foliate-js is a git submodule at packages/foliate-js/
  • Multiview paginator: loads adjacent sections in background, multiple View/Overlayer instances per book
  • Style overrides: getLayoutStyles() (always), getColorStyles() (when overriding color)
  • transformStylesheet() does regex-based EPUB CSS rewriting at load time
  • TTS uses independent section tracking (#ttsSectionIndex) decoupled from view
  • Safe area insets flow: Native plugin -> useSafeAreaInsets hook -> component styles
  • Dropdown menus use DropdownContext (not blur-based) for screen reader compat

Workflow