Skip to content

[WIKI-705] regression: mentions dropdown selection across editors#7901

Merged
pushya22 merged 1 commit intopreviewfrom
fix/editor-mentions
Oct 3, 2025
Merged

[WIKI-705] regression: mentions dropdown selection across editors#7901
pushya22 merged 1 commit intopreviewfrom
fix/editor-mentions

Conversation

@aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Oct 3, 2025

Description

This PR fixes the following bugs-

  1. Mentions dropdown not visible in peek overviews.
  2. Mentions command not working.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Summary by CodeRabbit

  • Bug Fixes

    • Mentions dropdown now reliably appears above content and positions correctly.
    • Escape key consistently closes the mentions dropdown with proper cleanup.
    • More predictable keyboard navigation within dropdowns.
  • Refactor

    • Standardized dropdown keyboard navigation using a shared key set across components.
    • Streamlined mentions dropdown event handling for more consistent behavior.
    • Reduced coupling and improved consistency in how editor context is passed and used.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

Note

Other AI code review bot(s) detected

CodeRabbit 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.

Walkthrough

Refactors 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

Cohort / File(s) Summary
Mentions dropdown render flow refactor
packages/editor/src/core/extensions/mentions/utils.ts
Updated renderMentionsDropdown signature to take args; standardized usage of props.editor and props.clientRect; added z-index on mount; updated Floating UI positioning calls; simplified onKeyDown to delegate to component ref and handle Escape; ensured cleanup via active extension removal and component destroy.
Slash command key handling constant
packages/editor/src/core/extensions/slash-commands/command-menu.tsx
Replaced local navigationKeys with shared DROPDOWN_NAVIGATION_KEYS in keyboard handler; no behavioral changes beyond centralizing the constant.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • Palanikannan1437
  • sriramveeraghanta

Poem

I twitch my ears at dropdowns new,
A hop, a pop—mentions in view!
Keys now shared, the flow made neat,
Escape to vanish—swift retreat.
On Floating winds, the menu flies,
A rabbit ships with bright replies. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The description field clearly outlines the bugs fixed and the type of change, but it omits the Test Scenarios section required by the repository template and also lacks References and any optional screenshots or media. Please add a “Test Scenarios” section describing how these fixes were verified and include any relevant References or Screenshots sections to fully adhere to the repository’s pull request template.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed The title includes the issue identifier and highlights the mentions dropdown regression across editors, which aligns with a key bug fix in the PR even though it does not capture every detail such as the mentions command repair. It refers to a genuine aspect of the changeset rather than being generic or off-topic. Therefore it is a valid, partially related summary of the main change.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/editor-mentions

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 45 to +51
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;
Copy link

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@pushya22 pushya22 changed the title regression: mentions dropdown selection across editors [WIKI-705] regression: mentions dropdown selection across editors Oct 3, 2025
@makeplane
Copy link

makeplane bot commented Oct 3, 2025

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@pushya22 pushya22 merged commit 269fc0d into preview Oct 3, 2025
7 checks passed
@pushya22 pushya22 deleted the fix/editor-mentions branch October 3, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants