Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[WEB-5415] fix: enter handler for emoji#8108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
im-vipin wants to merge1 commit intopreview
base:preview
Choose a base branch
Loading
fromfix-emoji_enter_handler

Conversation

@im-vipin
Copy link
Member

@im-vipinim-vipin commentedNov 13, 2025
edited by coderabbitaibot
Loading

Description

fix enter handler for emoji

Type of Change

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

Screenshots and Media (if applicable)

Screen.Recording.2025-11-13.at.1.35.10.PM.mov

Test Scenarios

References

Summary by CodeRabbit

  • Bug Fixes
    • Improved emoji picker keyboard navigation to properly handle Enter key selection and interactions.

CopilotAI review requested due to automatic review settingsNovember 13, 2025 08:07
@im-vipinim-vipin requested review fromPalanikannan1437 andaaryan610 and removed request foraaryan610 andCopilotNovember 13, 2025 08:07
@coderabbitai
Copy link
Contributor

coderabbitaibot commentedNov 13, 2025
edited
Loading

Walkthrough

Changes introduce emoji picker integration into the editor's keyboard handling system. A DOM identifier is added to the emoji picker container, node priority is configured for the emoji extension, and the editor's Enter key handler defers to the emoji picker when active.

Changes

Cohort / File(s)Summary
Emoji Picker Component
packages/editor/src/core/extensions/emoji/components/emojis-list.tsx
Addedid="emojis-picker" attribute to the dropdown container div for DOM identification and control flow reference.
Emoji Node Extension
packages/editor/src/core/extensions/emoji/emoji.ts
Configured emoji node priority to1001 in the node definition creation options.
Editor Keyboard Handler
packages/editor/src/core/props.ts
Added conditional early return in keydown handler: when Enter is pressed and an element withid="emojis-picker" exists, the handler returns true to bypass default slash-command handling and defer to the emoji picker.

Sequence Diagram(s)

sequenceDiagram    participant User    participant Editor as Editor (keydown handler)    participant Emoji as Emoji Picker        User->>Editor: Presses Enter    alt Emoji Picker (`#emojis-picker`) is visible        Editor->>Editor: Check for emoji picker element        Editor->>Emoji: Defer handling to emoji picker        Emoji->>User: Handle emoji selection    else Emoji Picker not visible        Editor->>Editor: Continue with slash-command handling    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Focus areas requiring attention:
    • The control flow logic inpackages/editor/src/core/props.ts requires understanding how the Enter key handler interacts with existing slash-command processing and the emoji picker state lifecycle
    • Verify the priority value1001 inpackages/editor/src/core/extensions/emoji/emoji.ts aligns with the intended node rendering order and doesn't conflict with other extensions
    • Confirm the DOM selector#emojis-picker is consistently used between the component and the keyboard handler

Poem

🐰 A little bunny hops around,
With emoji picker now so sound!
When Enter's pressed and picker's there,
It defers with keyboard flair!
Priority raised, ID assigned—
Emoji magic intertwined! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check nameStatusExplanationResolution
Description check⚠️ WarningThe description is largely incomplete. The 'Description' section only contains a one-line summary, and critical sections like 'Test Scenarios' and 'References' are empty with only template comments.Expand the Description section with details about what the bug was and how it was fixed. Complete Test Scenarios describing how the fix was validated, and link the related issue (WEB-5415).
✅ Passed checks (2 passed)
Check nameStatusExplanation
Title check✅ PassedThe title '[WEB-5415] fix: enter handler for emoji' clearly summarizes the main change—fixing the enter key handler for emoji functionality.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branchfix-emoji_enter_handler

Thanks for usingCodeRabbit! 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

@coderabbitaicoderabbitaibot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/editor/src/core/extensions/emoji/components/emojis-list.tsx (1)

124-124:LGTM! Consider extracting the ID as a constant.

Theid="emojis-picker" addition enables the Enter key handling fix inprops.ts. The approach is simple and effective.

For better maintainability, consider extracting this ID as a shared constant to avoid string duplication between this file andprops.ts:

// In a shared constants file:exportconstEMOJIS_PICKER_ID="emojis-picker";

Then use it in both locations:

-+        id={EMOJIS_PICKER_ID}
packages/editor/src/core/props.ts (1)

22-27:LGTM! Consider refactoring to reduce duplication.

The Enter key handling for the emoji picker correctly prevents default behavior when the picker is active, fixing the reported issue.

The logic duplicates the pattern used for slash commands (lines 29-34). Consider refactoring to reduce code duplication:

       keydown: (_view, event) => {-        // prevent default event listeners from firing when slash command is active-        if (["Enter"].includes(event.key)) {-          const emojisPicker = document.querySelector("#emojis-picker");-          if (emojisPicker) {-            return true;-          }-        }--        if (["ArrowUp", "ArrowDown", "Enter"].includes(event.key)) {-          const slashCommand = document.querySelector("#slash-command");-          if (slashCommand) {-            return true;-          }-        }+        // prevent default event listeners when suggestion dropdowns are active+        const activeDropdowns = [+          { keys: ["Enter"], selector: "#emojis-picker" },+          { keys: ["ArrowUp", "ArrowDown", "Enter"], selector: "#slash-command" },+        ];++        for (const { keys, selector } of activeDropdowns) {+          if (keys.includes(event.key) && document.querySelector(selector)) {+            return true;+          }+        }       },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and betweena04d3b5 and4d6e890.

📒 Files selected for processing (3)
  • packages/editor/src/core/extensions/emoji/components/emojis-list.tsx (1 hunks)
  • packages/editor/src/core/extensions/emoji/emoji.ts (1 hunks)
  • packages/editor/src/core/props.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Agent
  • GitHub Check: CodeQL analysis (javascript-typescript)
  • GitHub Check: Build and lint web apps
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
packages/editor/src/core/extensions/emoji/emoji.ts (1)

82-82:Emoji extension priority verified—no conflicts found.

Thepriority: 1001 is intentionally set higher than other extensions (utility and custom-link at 1000), ensuring emoji processes first in the event chain. All remaining extensions use the default priority, so there are no conflicts or inadvertent overrides.

@im-vipinim-vipin marked this pull request as draftNovember 13, 2025 10:39
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@coderabbitaicoderabbitai[bot]coderabbitai[bot] left review comments

@Palanikannan1437Palanikannan1437Awaiting requested review from Palanikannan1437

Copilot code reviewCopilotAwaiting requested review from CopilotCopilot will automatically review once the pull request is marked ready for review

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@im-vipin

[8]ページ先頭

©2009-2025 Movatter.jp