Skip to content

Conversation

VipinDevelops
Copy link
Member

@VipinDevelops VipinDevelops commented Jul 4, 2025

Description

Fixes a glitch that caused the emoji modal to scroll the page unintentionally.

Type of Change

  • Update Tippy modal with Floating UI
  • Properly handle all emoji-related shortcuts

Screenshots and Media (if applicable)

Screen.Recording.2025-07-04.at.4.37.25.PM.mov

Test Scenarios

References

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced emoji suggestion list with improved positioning, dynamic updates, and animated visibility.
    • Unified keyboard navigation for emoji selection, including Escape, Arrow keys, and Enter support.
  • Refactor

    • Removed external tooltip dependency for emoji suggestions, simplifying UI management and improving performance.
    • Streamlined accessibility markup and component structure for better maintainability.

Copy link
Contributor

coderabbitai bot commented Jul 4, 2025

Walkthrough

The changes refactor the emoji suggestion dropdown in the editor by removing the dependency on the tippy.js tooltip library and switching to direct React-based positioning using floating-ui. The EmojiList component is enhanced for better keyboard handling, dynamic positioning, and improved UI behavior, while accessibility markup is simplified.

Changes

File(s) Change Summary
.../emoji/components/emojis-list.tsx Enhanced EmojiList: added editor prop, dynamic positioning via floating-ui, unified keyboard handling, improved UI/ARIA, and scroll/visibility effects.
.../emoji/suggestion.ts Removed tippy.js tooltip logic; now manages emoji suggestion UI directly with React, simplifying control flow and positioning.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Editor
    participant EmojiList
    participant FloatingUI

    User->>Editor: Types ':' to trigger emoji suggestion
    Editor->>EmojiList: Mounts EmojiList with current selection and editor reference
    EmojiList->>FloatingUI: computePosition (using editor selection)
    FloatingUI-->>EmojiList: Returns position coordinates
    EmojiList->>EmojiList: Renders at computed position
    User->>EmojiList: Navigates with Arrow keys / selects emoji
    EmojiList->>Editor: Inserts selected emoji
    User->>Editor: Continues editing
Loading

Possibly related PRs

Suggested labels

✨feature, 🌐frontend, ✍️editor, ready to merge

Poem

🐇
The emojis now float, no tippy in sight,
With keyboard and scroll, they position just right.
React takes the lead, as the UI refines,
Suggestions appear where the cursor aligns.
A hop and a skip, the dropdown feels light—
Editor magic, from morning till night!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e2be814 and cbd97fd.

📒 Files selected for processing (2)
  • packages/editor/src/core/extensions/emoji/components/emojis-list.tsx (4 hunks)
  • packages/editor/src/core/extensions/emoji/suggestion.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/editor/src/core/extensions/emoji/suggestion.ts
  • packages/editor/src/core/extensions/emoji/components/emojis-list.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

makeplane bot commented Jul 4, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

@VipinDevelops VipinDevelops changed the title [ WIKI-521 ] fix : emoji unexpectedly scroll [WIKI-521] fix : emoji unexpectedly scroll Jul 4, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot 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: 2

🧹 Nitpick comments (3)
packages/editor/src/core/extensions/emoji/suggestion.ts (1)

86-100: Consider removing the component element from DOM explicitly.

While component.destroy() handles React unmounting, the element might still be attached to the DOM.

         // Cleanup
         if (component) {
+          component.element?.remove();
           component.destroy();
         }
packages/editor/src/core/extensions/emoji/components/emojis-list.tsx (2)

91-108: Consider throttling scroll event handler for better performance.

The scroll handler could be called frequently, potentially causing performance issues. Consider throttling the position updates.

+import { throttle } from "lodash-es"; // or implement a simple throttle

   useEffect(() => {
-    const handleScroll = () => {
+    const handleScroll = throttle(() => {
       if (containerRef.current && editor) {
         updatePosition(editor, containerRef.current);
       }
-    };
+    }, 16); // ~60fps

     document.addEventListener("scroll", handleScroll, true);
-    return () => document.removeEventListener("scroll", handleScroll, true);
+    return () => {
+      handleScroll.cancel?.();
+      document.removeEventListener("scroll", handleScroll, true);
+    };
   }, [editor]);

147-150: Consider using a design system z-index scale.

The hardcoded z-index of 100 might conflict with other UI elements. Consider using a z-index scale from your design system.

       style={{
         position: "absolute",
-        zIndex: 100,
+        zIndex: "var(--z-dropdown, 100)", // or use a constant from your design system
       }}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 509db32 and e2be814.

📒 Files selected for processing (2)
  • packages/editor/src/core/extensions/emoji/components/emojis-list.tsx (4 hunks)
  • packages/editor/src/core/extensions/emoji/suggestion.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/editor/src/core/extensions/emoji/components/emojis-list.tsx (1)
packages/utils/src/common.ts (1)
  • cn (8-8)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (7)
packages/editor/src/core/extensions/emoji/suggestion.ts (3)

9-9: Clean refactoring to remove tippy.js dependency.

The import changes and variable declarations properly support the new React-based positioning approach.

Also applies to: 38-39


64-72: Proper null check and prop updates.

Good defensive programming with the component existence check before updating props.


74-84: Well-structured keyboard event delegation.

Good use of optional chaining and proper delegation pattern to the EmojiList component.

packages/editor/src/core/extensions/emoji/components/emojis-list.tsx (4)

61-89: Excellent keyboard navigation implementation.

The unified keyboard handling with circular navigation and proper event prevention is well-designed.


110-115: Smart animation timing for smooth appearance.

The delayed visibility ensures proper positioning before the fade-in animation begins.


120-134: Good UX with automatic scroll-to-selected behavior.

The scroll-into-view logic ensures the selected emoji is always visible during keyboard navigation.


160-183: Well-implemented emoji buttons with good accessibility.

The button implementation includes proper hover states, selection indication, and fallback image support.

@VipinDevelops VipinDevelops requested a review from aaryan610 July 4, 2025 11:34
@sriramveeraghanta sriramveeraghanta merged commit 28375c4 into preview Jul 4, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the feat-emoji_fix branch July 4, 2025 13:05
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* fix: emoji modal scroll

* refactor: emoji list

* fix: escape behavior

* fix: minor type fixes
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.

3 participants