Skip to content

fix(ai-edition): let chat message text be selected and copied - #22

Closed
My-Denia wants to merge 1 commit into
mainfrom
fix/739-chat-message-text-selection
Closed

My-Denia wants to merge 1 commit into
mainfrom
fix/739-chat-message-text-selection

Conversation

@My-Denia

Copy link
Copy Markdown
Owner

Summary

Fixes getopenscreen#739. AI chat message text could not be selected with the mouse: the global stylesheet disables selection on body and the editor shell re-disables it on .app, and nothing opted the chat bubble back in. With no selection possible, Ctrl+C and Edit → Copy had nothing to act on — which hurt most when the message contained a command or a code snippet and the message's own Copy button was also failing (see getopenscreen#738).

The fix

One scoped CSS rule: .msgBubble { user-select: text; } in NewEditorShell.module.css. The bubble is exactly the readable body of a chat message; buttons, the timeline, the inspector, and the panel chrome keep inheriting user-select: none, so nothing else becomes selectable.

Regression evidence (old FAIL / new PASS)

tests/e2e/chat-message-selection.spec.ts (Playwright, browser-shim editor, follows the v4-shell.spec.ts seeding pattern) sends a chat turn so the shim's canned assistant reply renders, then drags across the bubbles with real mouse events and asserts the selection is real bubble text; it also asserts the session header still computes user-select: none.

  • with the CSS change stashed: both tests fail — the drag produces an empty selection, exactly the reported bug;
  • with the fix: both pass. Adjacent specs (editor-smoke, v4-shell) still pass.

Real-machine verification (Windows 11, computer-use driven)

  • Baseline reproduction on current main (dev build): a real-mouse drag across the assistant text and the user text created no selection, and Ctrl+C left the clipboard (sentinel read-back) untouched — matching the report.
  • With the fix: dragging the assistant text shows the selection highlight and Ctrl+C copies the exact dragged fragment (unicode, CJK, emoji intact); dragging the user message and Ctrl+C copies the full user turn; a drag across the inspector's static header selects nothing and leaves the clipboard alone.
  • Interaction with the [Bug]: AI chat message copy button always reports "Couldn't copy" on Windows getopenscreen/openscreen#738 fix: none — that change is the copy button's write path (preload/IPC), this one is a CSS rule on the bubble; disjoint files, each verified independently on real Windows.

One scoping decision to flag: the expanded "thinking" trace stays non-selectable — it is ephemeral (only exists for the turn that streamed it), it is wrapped in the collapsible toggle button, and the issue's acceptance case covers user/assistant message bodies. Enabling it later is a one-liner if wanted.

Intent

Opened against the fork for review; ready for an owner decision before any upstream submission (per the standing rule, no upstream PR will be created without explicit approval).

Copilot AI lite review requested due to automatic review settings September 25, 2026 15:05
@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 9e19b889-af53-47f6-91bb-0c822e31b029


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.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T17:36:05.960839Z 8f70a81 New commits
🔒 Security Review ✅ Completed 2026-09-25T15:09:04.961049Z 0f2f3ab PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@My-Denia
My-Denia force-pushed the fix/739-chat-message-text-selection branch from 0f2f3ab to 596eeb7 Compare September 25, 2026 15:11

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f2f3abc8b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1428 to +1433
/* Selectable: the message body exists to be read and copied, and without
* this it inherits the shell's user-select: none — drag selection and
* Ctrl+C silently do nothing (issue #739). Scoped to the bubble so
* buttons, the timeline, and the inspector keep their non-selectable
* behavior. */
user-select: text;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve native copy for selected chat text

On Windows/Linux, if a timeline region or clip remains selected when the user drag-selects a message, Ctrl+C is still caught by the editor shortcut in NewEditorShell.tsx:1303-1314; that handler calls preventDefault() and copies the region/clip instead, leaving the OS clipboard without the selected message text. Opening or interacting with chat does not clear those timeline selections, and the new Playwright test only inspects window.getSelection() rather than exercising the copy command. Give a non-collapsed DOM text selection precedence over the editor-level copy shortcut and cover that scenario.

AGENTS.md reference: AGENTS.md:L78-L79

Useful? React with 👍 / 👎.

@My-Denia
My-Denia force-pushed the fix/739-chat-message-text-selection branch 2 times, most recently from f83edae to 0e4b3a4 Compare September 25, 2026 16:54
The global stylesheet disables selection on body and the editor shell
re-disables it on .app, so drag selection across AI chat message text
silently did nothing — and with no selection, Ctrl+C and Edit → Copy had
nothing to copy (issue getopenscreen#739).

Opt the message bubble back in with user-select: text. The rule is
scoped to .msgBubble, so buttons, the timeline, the inspector, and the
panel chrome keep their non-selectable behavior.

tests/e2e/v4-shell.spec.ts gains one test in its existing harness: a
real-mouse drag across the user turn and across the shim's canned
assistant reply must produce a selection, and the session header must
still resolve to user-select: none. The drag assertions fail without
the CSS change and pass with it.
@My-Denia
My-Denia force-pushed the fix/739-chat-message-text-selection branch from 0e4b3a4 to 8f70a81 Compare September 25, 2026 17:34
@My-Denia My-Denia closed this Sep 26, 2026
@cursor
cursor Bot deleted the fix/739-chat-message-text-selection branch September 26, 2026 12:08
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.

[Bug]: AI chat message text cannot be selected or copied manually

2 participants