fix(ui): let users select and copy chat thread text - #3992
Merged
Conversation
Quill's ContextMenuTrigger hardcodes `select-none` on its rendered element
(`className: cn("select-none", className)`). MessageContextMenu wraps every
message bubble in that trigger, so the class landed on each ChatMessage root
and, because `user-select` inherits in Chromium, every descendant down to the
message `<p>` computed to `user-select: none`.
The visible effect was that a drag produced no usable selection at all: a
Range over the text serialised to `""`, so copy came back empty.
Quill's `cn` is tailwind-merge, so passing `select-text` at the call site wins
over the hardcoded `select-none` without touching the package. Scoped to the
chat thread; the other two ContextMenuTrigger call sites (tab pills, channel
rows) are chrome where `select-none` is correct.
Verified against the running dev app over CDP, same synthetic mouse drag both
ways: `select-none` selects `""`, `select-text` selects the message text. User
bubbles and assistant prose both go through this trigger, and the right-click
"Copy message" / "Show raw logs" menu still opens.
Generated-By: PostHog Code
Task-Id: c0412de8-5b4e-4f02-857e-20297eb9c77d
|
😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details. |
Contributor
|
Reviews (1): Last reviewed commit: "fix(ui): let users select and copy chat ..." | Re-trigger Greptile |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
There was a problem hiding this comment.
Single-line CSS class fix scoped to one component, no risky territory touched, well-documented and verified by author.
- 👍 on the PR from greptile-apps[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 2L, 1F substantive — within ceiling |
| tier | ✓ | T1-agent / T1a-trivial (2L, 1F, single-area, fix) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ f4fec98 · reviewed head 7f51366 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
You can't drag-select text in the chat thread, so you can't copy it.
Root cause
Quill's
ContextMenuTriggerhardcodesselect-noneon its rendered element:MessageContextMenuinChatThread.tsxwraps every message bubble in that trigger so users can right-click → "Copy message". That putselect-noneon eachChatMessageroot, and sinceuser-selectinherits in Chromium, every descendant down to the message<p>computed touser-select: none.So the feature added to make a single message copyable is what made the whole thread uncopyable.
The failure mode is total, not partial. A
Rangeover the message text is valid and laid out, but serialises to""— and that's what the clipboard reads:Fix
Quill's
cnistwMerge(clsx(...)), so passingselect-textat the call site wins over the hardcodedselect-none— no package change needed:Scoped deliberately to the chat thread. The other two
ContextMenuTriggercall sites (TabStrippills,ChannelsListrows) are chrome whereselect-noneis the correct behaviour and are left alone.Verification
Driven against the running dev app over CDP (
test-electron-app), same synthetic mouse drag over the same message both ways:getSelection().toString()after dragselect-none(before)""select-text(after)"test123"Also confirmed:
user-selecton the message<p>goesnone→text.UserBubble(ChatThread.tsx:400) andAgentProse(:565) both route through this oneMessageContextMenu. Checked a thread with real assistant prose: user message and assistant reply both select.biome checkclean;vitestchat-thread suite 47/47.A note on a wrong first guess
My initial diagnosis was that quill's
.quill-chat-message-scroller__item { content-visibility: auto }was the culprit. I applied that fix, re-measured, and selection was still empty —content-visibilitywas not the cause. Reverted it; only the one-line change above ships. Worth recording because thecontent-visibilitytheory is superficially plausible and someone will reach for it again.Created with PostHog Code