Hotkeys Expand/Collapse Reference children fix#498
Conversation
- Introduced `findContextMenuOption` to streamline option retrieval. - Created `triggerContextMenu` for dispatching context menu events. - Updated `expandReferenceChildren` and `collapseReferenceChildren` to use the new functions with error handling. - Improved readability and maintainability by reducing nested calls and using early returns.
WalkthroughThis update introduces two new utility functions in the jump navigation component. The Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant ER as expandReferenceChildren
participant B as Button Element
participant CM as Context Menu
U->>ER: Initiate Expand Action
ER->>B: triggerContextMenu()
B->>CM: Simulate right-click
ER->>CM: findContextMenuOption("Expand all")
CM-->>ER: Return "Expand all" element
ER->>CM: Click "Expand all"
sequenceDiagram
participant U as User
participant CR as collapseReferenceChildren
participant B as Button Element
participant CM as Context Menu
U->>CR: Initiate Collapse Action
CR->>B: triggerContextMenu()
B->>CM: Simulate right-click
CR->>CM: findContextMenuOption("Collapse all")
CM-->>CR: Return "Collapse all" element
CR->>CM: Click "Collapse all"
Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (6)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
| const triggerContextMenu = (element: HTMLElement) => { | ||
| const event = new MouseEvent("contextmenu", { | ||
| bubbles: true, | ||
| button: 2, |
There was a problem hiding this comment.
The fix is adding button: 2. The rest is refactor.
Summary by CodeRabbit