Repository navigation
Closed
Description
Problem Statement
With multiple viewers (tabs/panes) active, we need to coordinate:
- Which viewer receives keyboard shortcuts and focus
- Independent scroll positions per viewer
- Cursor position preservation during external updates
- Visual feedback for active vs inactive viewers
Current State
What Exists:
- ✅ Multiple ReactiveNodeService instances
- ✅ SharedNodeStore for data coordination
What's Missing:
- ❌ Active viewer tracking for keyboard shortcuts
- ❌ Scroll position management per viewer
- ❌ Cursor preservation during real-time updates
- ❌ Visual indicators for active/inactive state
Proposed Solution
Implement viewer coordination system:
- Track active viewer ID globally
- Route keyboard shortcuts to active viewer only
- Store scroll position per viewer instance
- Implement semantic cursor anchoring for updates
- Add visual indicators for viewer focus state
Key Concerns
Focus Management:
- Only one viewer should handle keyboard shortcuts at a time
- Clicking into a viewer should activate it
- Tab switching should update active viewer
Scroll Position:
- Each viewer maintains independent scroll state
- Scroll position preserved when switching tabs
- Restore scroll on tab reactivation
Cursor Preservation:
- During external updates, maintain cursor position semantically
- Use content-based anchoring (not just character offset)
- Handle insertions/deletions around cursor gracefully
Main Components Affected
Modified Files:
/packages/desktop-app/src/lib/services/reactive-node-service.svelte.ts- Add viewer activation/packages/desktop-app/src/lib/components/base-node-viewer.svelte- Track focus state/packages/desktop-app/src/lib/stores/viewer-focus.ts- Global focus tracking (new)
Acceptance Criteria
- Keyboard shortcuts routed to active viewer only
- Visual indicator shows which viewer is active
- Scroll position independent per viewer
- Cursor position preserved during external updates
- Clicking into viewer activates it
- Tab switch updates active viewer automatically
Estimated Effort
6-8 hours
- Focus management: 2 hours
- Scroll position tracking: 2 hours
- Cursor anchoring: 2-3 hours
- Visual indicators: 1 hour
- Testing: 1-2 hours
Dependencies
- Requires: Implement Tab/Pane Management UI (Phases 4-8) #206 (EPIC), Implement nodespace:// Link Navigation with Dynamic Tab Creation #297 (Link Navigation)
- Related: Split-Pane Layout System #300 (Split-Pane) - essential for split view coordination
Priority
Medium-High - Important for multi-viewer UX but not blocking basic functionality
Activity
feat: Phase 1 - Keyboard shortcut routing to active pane (#301)
feat: Phase 2 - Independent scroll position tracking per viewer (#301)
style: Add autohide scrollbar for cleaner viewer UX (#301)
refactor: Address all code review recommendations for issue #301
Viewer Coordination: Focus, Scroll, and Cursor Management (#373)
Viewer Coordination: Focus, Scroll, and Cursor Management (#373)
Viewer Coordination: Focus, Scroll, and Cursor Management (#373)
Viewer Coordination: Focus, Scroll, and Cursor Management (#373)