Skip to content

Fixed search input colours and click outside to close#1973

Open
weylandswart wants to merge 1 commit into
mainfrom
weyland-des-1037-regression-input-field-text-color-in-callout-emoji-picker-is
Open

Fixed search input colours and click outside to close#1973
weylandswart wants to merge 1 commit into
mainfrom
weyland-des-1037-regression-input-field-text-color-in-callout-emoji-picker-is

Conversation

@weylandswart

Copy link
Copy Markdown

Closes https://linear.app/ghost/issue/DES-1037/regression-input-field-text-color-in-callout-emoji-picker-is-too-light

Improves contrast in the search input and adds click outside to close the emoji picker.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR adds a click-outside handler capability to the EmojiPickerPortal component. The EmojiPickerPortal now accepts an optional onClickOutside prop and uses the useClickOutside hook with a ref to the picker container to detect clicks outside the element. The CalloutCard integrates this new prop by passing a callback that closes the emoji picker when clicking outside. Additionally, dark-mode CSS styling for the emoji picker component is updated with refined color values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: it mentions both the search input colours fix and the click outside to close feature.
Description check ✅ Passed The description is directly related to the changeset, detailing the issue being closed and the two main improvements being made.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch weyland-des-1037-regression-input-field-text-color-in-callout-emoji-picker-is

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
packages/koenig-lexical/src/components/ui/cards/CalloutCard.jsx (1)

128-128: ⚡ Quick win

Memoize the onClickOutside callback.

The inline arrow function creates a new reference on every render, causing the click-outside listener in EmojiPickerPortal to be re-registered unnecessarily.

⚡ Suggested fix using useCallback

Add the memoized callback after line 101:

 const emojiButtonRef = React.useRef(null);
 const {darkMode} = React.useContext(KoenigComposerContext);
+
+const handleClickOutside = React.useCallback(() => {
+    setShowEmojiPicker(false);
+}, [setShowEmojiPicker]);

Then use the memoized callback at line 128:

-                                onClickOutside={() => setShowEmojiPicker(false)}
+                                onClickOutside={handleClickOutside}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/koenig-lexical/src/components/ui/cards/CalloutCard.jsx` at line 128,
The inline onClickOutside prop is recreating a new function each render and
causing EmojiPickerPortal to re-register its click-outside listener; memoize it
by creating a useCallback hook (e.g., const handleEmojiPickerClickOutside =
useCallback(() => setShowEmojiPicker(false), [setShowEmojiPicker])) inside the
CalloutCard component and pass handleEmojiPickerClickOutside to
EmojiPickerPortal instead of the inline arrow function.
packages/koenig-lexical/src/styles/components/koenig-lexical.css (1)

89-101: ⚡ Quick win

Scope em-emoji-picker styles under .koenig-lexical for guideline compliance.

The em-emoji-picker selector is not scoped under .koenig-lexical, which violates the coding guideline. The dark-mode styles (lines 60-69) are properly scoped, creating an inconsistency. As per coding guidelines, all styles in this file should be scoped under the .koenig-lexical class.

♻️ Suggested refactor to scope the selector
-.koenig-lexical.koenig-lexical-caption {
-    font-size: 0;
-
-    > * {
-        font-size: 1.4rem;
-    }
-}
-
-/* Caption in dark mode */
-.koenig-lexical-caption p {
-    color: var(--grey-800);
-}
-
-.dark .koenig-lexical-caption p {
-    color: var(--grey-500);
-}
-
-em-emoji-picker {
+.koenig-lexical em-emoji-picker {
     --font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Droid Sans", "Helvetica Neue", sans-serif;
     --border-radius: 5px;
     /* --background-rgb: 85, 170, 255; */
     --font-size: 13px;
     --rgb-accent: 57, 64, 71;
     --rgb-color: 57, 64, 71;
     --em-rgb-accent: (255,0,0)
     /* --rgb-input: 255, 235, 235; */;
     --shadow: 0 0 1px rgba(0,0,0,.05), 0 5px 18px rgba(0,0,0,.08);
 
     height: 325px;
   }
 
-  em-emoji-picker `#nav` button[aria-selected] svg {
+.koenig-lexical em-emoji-picker `#nav` button[aria-selected] svg {
     fill: red;
   }
 
-  em-emoji-picker .search input[type="search"] {
+.koenig-lexical em-emoji-picker .search input[type="search"] {
     border-radius: 5px;
   }
+
+.koenig-lexical.koenig-lexical-caption {
+    font-size: 0;
+
+    > * {
+        font-size: 1.4rem;
+    }
+}
+
+/* Caption in dark mode */
+.koenig-lexical-caption p {
+    color: var(--grey-800);
+}
+
+.dark .koenig-lexical-caption p {
+    color: var(--grey-500);
+}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/koenig-lexical/src/styles/components/koenig-lexical.css` around
lines 89 - 101, The em-emoji-picker block is not scoped under .koenig-lexical;
wrap or rename the selector so the rules apply only within the Koenig component
(e.g., change em-emoji-picker { ... } to .koenig-lexical em-emoji-picker { ...
}) to match the dark-mode blocks and comply with the file's scoping guideline;
ensure the same variable definitions and properties inside the selector remain
unchanged when moved under .koenig-lexical.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/koenig-lexical/src/components/ui/cards/CalloutCard.jsx`:
- Line 128: The inline onClickOutside prop is recreating a new function each
render and causing EmojiPickerPortal to re-register its click-outside listener;
memoize it by creating a useCallback hook (e.g., const
handleEmojiPickerClickOutside = useCallback(() => setShowEmojiPicker(false),
[setShowEmojiPicker])) inside the CalloutCard component and pass
handleEmojiPickerClickOutside to EmojiPickerPortal instead of the inline arrow
function.

In `@packages/koenig-lexical/src/styles/components/koenig-lexical.css`:
- Around line 89-101: The em-emoji-picker block is not scoped under
.koenig-lexical; wrap or rename the selector so the rules apply only within the
Koenig component (e.g., change em-emoji-picker { ... } to .koenig-lexical
em-emoji-picker { ... }) to match the dark-mode blocks and comply with the
file's scoping guideline; ensure the same variable definitions and properties
inside the selector remain unchanged when moved under .koenig-lexical.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5c773ccb-eafe-4a69-ac00-955a4cdc9d77

📥 Commits

Reviewing files that changed from the base of the PR and between dc7c28a and eab721b.

📒 Files selected for processing (3)
  • packages/koenig-lexical/src/components/ui/EmojiPickerPortal.jsx
  • packages/koenig-lexical/src/components/ui/cards/CalloutCard.jsx
  • packages/koenig-lexical/src/styles/components/koenig-lexical.css

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant