Enhance thread navigation with improved expand/collapse behavior

Major improvements to threaded conversation navigation:

- Add Shift+Left shortcut to navigate to thread root from any reply
- Fix navigation state synchronization using accessibility flags instead of Qt's isExpanded()
- Implement proper child item flag management (selectable/non-selectable)
- Add comprehensive scrollToItem() calls for better focus management
- Enhance navigation methods with safety checks and proper state handling
- Force visual refresh attempts to work around Qt display sync issues

Navigation improvements:
- Right Arrow: Expand thread or move to first child when expanded
- Left Arrow: Collapse thread or move to parent
- Shift+Left: Jump to thread root from anywhere in the thread
- All navigation properly skips collapsed items

Known Qt quirk documented: Visual display may occasionally require
double-collapse cycle due to Qt tree widget display synchronization,
but navigation logic works correctly after first collapse.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Storm Dragon
2025-07-21 10:07:41 -04:00
parent ed7de5dafa
commit 1391d0c66f
3 changed files with 129 additions and 47 deletions

View File

@ -185,13 +185,21 @@ Timeline Item: "Alice posted: Hello world (3 replies, collapsed)"
```
**Key Behaviors:**
- Right Arrow: Expand thread, announce "expanded"
- Left Arrow: Collapse thread, announce "collapsed"
- Right Arrow: Expand thread, announce "expanded" / Move to first child when expanded
- Left Arrow: Collapse thread, announce "collapsed" / Move to parent
- Shift+Left Arrow: Navigate to thread root from any reply
- Down Arrow: Next item (skip collapsed children)
- Up Arrow: Previous item
- Page Down/Up: Jump 5 items
- Home/End: First/last item
### Known Qt Tree Widget Display Quirk
Due to Qt's visual display synchronization, thread collapse may require double-operation:
- Navigation logic works correctly after first collapse (skips collapsed items)
- Visual display may need expand→collapse cycle to fully sync
- Workaround: Navigate to root with Shift+Left, then Left→Right→Left if needed
### AccessibleTreeWidget Requirements
- Inherit from QTreeWidget
- Override keyPressEvent for custom navigation