[WIKI-705] regression: mentions dropdown selection across editors#7901
[WIKI-705] regression: mentions dropdown selection across editors#7901
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughRefactors the mentions dropdown renderer to accept a single args object, route interactions via props.editor, and simplify key handling and cleanup, including z-index styling and Floating UI updates. Separately, the slash command menu now uses a shared DROPDOWN_NAVIGATION_KEYS constant for key filtering. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant E as Editor
participant M as Mentions Extension
participant D as Dropdown Component
participant F as Floating UI
U->>E: Type '@' + query
E->>M: trigger render({ editor, clientRect, query })
M->>D: create/mount component (z-index 100)
D->>F: position via updateFloatingUI(editor, clientRect)
Note over D,F: Positions update on start/update
U->>E: Keydown (Arrow/Enter)
E->>D: onKeyDown({ event })
D-->>E: handled? (true/false)
U->>E: Keydown (Escape)
E->>D: onKeyDown({ event: Escape })
D->>M: destroy component, remove active extension
M-->>E: cleanup complete
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes two bugs related to the mentions dropdown: visibility issues in peek overviews and non-functioning mentions commands. The changes refactor parameter naming for clarity and remove redundant keyboard navigation logic to improve dropdown behavior consistency across different editor contexts.
- Simplified mentions dropdown keyboard navigation handling
- Improved parameter destructuring and naming in mentions utilities
- Added proper z-index styling for dropdown visibility
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/editor/src/core/extensions/slash-commands/command-menu.tsx | Replaced hardcoded navigation keys array with shared constant |
| packages/editor/src/core/extensions/mentions/utils.ts | Refactored parameter handling and simplified keyboard navigation logic |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if (event.key === "Escape") { | ||
| component?.destroy(); | ||
| component = null; | ||
| return true; | ||
| } | ||
|
|
||
| const navigationKeys = ["ArrowUp", "ArrowDown", "Enter"]; | ||
|
|
||
| if (navigationKeys.includes(event.key)) { | ||
| event?.stopPropagation(); | ||
| return component?.ref?.onKeyDown({ event }); | ||
| } | ||
| return component?.ref?.onKeyDown({ event }); | ||
| return component?.ref?.onKeyDown({ event }) ?? false; |
There was a problem hiding this comment.
The simplified keyboard handling removes the specific navigation key filtering and event propagation control that was present in the original code. This could lead to unintended behavior where all keyboard events are passed to the component regardless of their type.
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
Description
This PR fixes the following bugs-
Type of Change
Summary by CodeRabbit
Bug Fixes
Refactor