-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[WIKI-521] fix : emoji unexpectedly scroll #7344
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe 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
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
Possibly related PRs
Suggested labels
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Pull Request Linked with Plane Work Items Comment Automatically Generated by Plane |
There was a problem hiding this 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
📒 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.
packages/editor/src/core/extensions/emoji/components/emojis-list.tsx
Outdated
Show resolved
Hide resolved
* fix: emoji modal scroll * refactor: emoji list * fix: escape behavior * fix: minor type fixes
Description
Fixes a glitch that caused the emoji modal to scroll the page unintentionally.
Type of Change
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
Refactor