Skip to content

fix(workspace-emoji): keep the ':' shortcode suggestions scrolled to the highlight - #13969

Merged
nwparker merged 1 commit into
mainfrom
nwparker/emoji-picker-follow
Aug 12, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/emoji-picker-follow

Conversation

@nwparker

@nwparker nwparker commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Type :smi in a workspace-name field and a little emoji list pops up. Holding ↓ moved the highlight down the list but the list never scrolled, so the highlight disappeared below the visible area. Now the list follows the highlight.

What Changed

WorkspaceEmojiSuggestionPopover scrolls the selected suggestion into view whenever the selection changes, mirroring cmdk's own scrollSelectedIntoView (including revealing the group heading when the first item is selected).

Why

Arrow keys are handled in useWorkspaceEmojiShortcodeInput because focus stays in the text input — it moves the highlight by setting cmdk's controlled value prop. cmdk only calls scrollSelectedIntoView from its internal setState('value', …) path; when the controlled prop changes externally it just writes state and re-renders ([email protected], the useLayoutEffect on value). So nothing ever scrolled the max-h-56 list.

Matching the item by data-value rather than data-selected avoids depending on when cmdk's store emit lands relative to our effect.

Fixed in the shared popover, so it covers all four consumers: WorktreeDisplayNameField, WorktreeTitleInlineRename, SmartWorkspaceNameField, WorktreeJumpPalette.

Linked Issue

Fixes #

Visual Proof

Not captured — happy to record a before/after if wanted. The behavior is covered by an automated regression test instead (see Testing).

Testing

Repro: focus any workspace-name field, type :s, hold ↓ — before this change the highlight leaves the visible list; after, the list scrolls with it.

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/workspace-emoji/ → 6 passed

  • New WorkspaceEmojiSuggestionPopover.test.tsx asserts the externally-selected item is scrolled into view; verified it fails with the new effect disabled and passes with it

  • oxlint + typecheck:web clean

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Renderer-only, no platform-specific APIs, no wire/IPC surface — same behavior on macOS/Linux/Windows and over SSH/remote. The effect is a single querySelectorAll over the ≤N suggestion items, only on selection change.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Made with Orca 🐋

…the highlight

Arrow keys are handled by the input, so the highlight moved via cmdk's
controlled `value` prop — a path that never runs cmdk's own
scrollSelectedIntoView. Selection could walk below the visible list.
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0bfdd4c7-ea23-4d18-b56c-687530fd32f5

📥 Commits

Reviewing files that changed from the base of the PR and between 5bee7b5 and 2844475.

📒 Files selected for processing (2)
  • src/renderer/src/components/workspace-emoji/WorkspaceEmojiSuggestionPopover.test.tsx
  • src/renderer/src/components/workspace-emoji/WorkspaceEmojiSuggestionPopover.tsx

📝 Walkthrough

Walkthrough

The emoji suggestion popover now tracks its command list with a ref. When the popover opens or its command value or suggestions change, it scrolls the selected suggestion into view. If the suggestion is first in its group, the group heading is scrolled instead. Tests cover external selection changes after rerendering and stub DOM scrolling behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is detailed, but it omits the required linked issue and required before/after visual proof for a UI behavior change. Add a valid Fixes #... issue reference and attach before/after screenshots or a video; mark manual testing complete if performed.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: keeping workspace emoji shortcode suggestions scrolled to the highlighted item.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@nwparker
nwparker merged commit 9e18e14 into main Aug 12, 2026
45 checks passed
@nwparker
nwparker deleted the nwparker/emoji-picker-follow branch August 12, 2026 05:18
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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