Repository navigation
Closed
Labels
Description
Bug: Focus Management Failures
Related to: Issue #208 (Comprehensive Test Coverage)
Test File: src/tests/integration/focus-management.test.ts
Failures: 17 tests
Problem
Focus management tests are failing across multiple scenarios:
Modal Focus - Autocomplete (5 failures)
- should maintain editor focus even when typing trigger characters
- should maintain editor focus when typing slash character
- should maintain focus when pressing Enter after typing
- should maintain focus when pressing Escape
- should trap focus within modal context when Tab is pressed
Node Creation Focus (4 failures)
- should maintain editor focus after Enter key press
- should position cursor at start of new node after Enter
- should preserve editor focusability after content split with Enter
- should support programmatic focus via autoFocus prop
Focus Restoration (3 failures)
- should allow manual focus restoration after blur
- should maintain focus during arrow key navigation within editor
- should maintain focus during text selection
Slash Command Focus (3 failures)
- should maintain editor focus after slash command insertion
- should auto-focus editor after node type conversion via slash command
- should maintain focus if autocomplete trigger fails
Error Handling (2 failures)
- should maintain focusability after user interaction
- should maintain focus if slash command fails
Root Causes
Likely issues:
- Modal components (autocomplete, slash dropdown) stealing focus
- Improper focus restoration after keyboard operations
- Missing
autoFocusprop handling in node components - Focus lost during async operations
Acceptance Criteria
- All 17 focus management tests pass
- Editor maintains focus during:
- Modal interactions (autocomplete, slash commands)
- Node creation/deletion operations
- Arrow key navigation
- Text selection
- Proper focus restoration after blur events
- Tab trapping works correctly in modal contexts
- Quality checks pass:
bun run quality:fix
Testing
Run: bun run test src/tests/integration/focus-management.test.ts
Estimated Effort
- Time: 3-4 hours
- Complexity: Medium-High (requires DOM focus API understanding)
- Risk: Medium (affects user interaction quality)
Activity
Fix web mode and refactor: origin_id → container_id terminology
Fix two critical bugs in BaseNodeViewer and add comprehensive tests
Session Handoff: Shift+Enter Multiline Fixes Complete
malibio commentedon Oct 13, 2025
✅ ALL 17 TESTS NOW PASSING
Verified with:
The failures were resolved by recent commits (likely PR #268 for #258 or other refactoring work).
This reduces remaining failures from 65 → 48.
Closing as resolved.
malibio commentedon Oct 13, 2025
The tests PASS when run in isolation:
But FAIL when run as part of the full test suite:
This indicates a test isolation problem - likely:
This is a real bug that needs investigation. The issue is not with the focus management code itself, but with test suite isolation.
Fix test pollution: Remove global document override from node-referen…
Fix web mode and refactor: origin_id → container_id terminology
Fix two critical bugs in BaseNodeViewer and add comprehensive tests
Fix test pollution: Remove global document override from node-referen…
Fix web mode and refactor: origin_id → container_id terminology
Fix two critical bugs in BaseNodeViewer and add comprehensive tests
Fix test pollution: Remove global document override from node-referen…
Fix web mode and refactor: origin_id → container_id terminology
Fix two critical bugs in BaseNodeViewer and add comprehensive tests
Fix test pollution: Remove global document override from node-referen…