Skip to content

fix(web-chat): normalize chat copy to plain text#1114

Merged
ilblackdragon merged 2 commits intonearai:stagingfrom
G7CNF:codex/issue-1059-plain-copy
Mar 15, 2026
Merged

fix(web-chat): normalize chat copy to plain text#1114
ilblackdragon merged 2 commits intonearai:stagingfrom
G7CNF:codex/issue-1059-plain-copy

Conversation

@G7CNF
Copy link
Copy Markdown
Contributor

@G7CNF G7CNF commented Mar 13, 2026

Summary

  • force plain-text clipboard output when users copy selected content from chat messages
  • prevent rich-text style leakage (e.g. white text from dark UI) when pasting into white-background apps like Google Sheets
  • add an E2E regression test for chat copy behavior

Issue

Validation

  • node --check src/channels/web/static/app.js
  • python3 -m py_compile tests/e2e/scenarios/test_chat.py

@github-actions github-actions bot added size: M 50-199 changed lines scope: channel/web Web gateway channel labels Mar 13, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the user experience by standardizing the copy-paste functionality within the web chat interface. It addresses an issue where rich-text formatting could be inadvertently carried over when copying chat messages, leading to inconsistent styling in external applications. By ensuring that only plain text is copied, the change provides a cleaner and more predictable interaction for users, backed by a new E2E test to prevent future regressions.

Highlights

  • Clipboard Behavior: Implemented a mechanism to force plain-text clipboard output when users copy selected content from chat messages, preventing rich-text style leakage (e.g., white text from dark UI) when pasting into other applications.
  • Testing: Added a new end-to-end regression test to validate the chat copy behavior, ensuring that only plain text is copied to the clipboard.
Changelog
  • src/channels/web/static/app.js
    • Added an event listener for the 'copy' event on the 'chat-messages' element to intercept and normalize clipboard data to 'text/plain'.
  • tests/e2e/scenarios/test_chat.py
    • Introduced a new asynchronous test function, test_copy_from_chat_forces_plain_text, to programmatically simulate copying chat content and assert that only plain text is stored in the clipboard.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions bot added risk: medium Business logic, config, or moderate-risk modules contributor: experienced 6-19 merged PRs labels Mar 13, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a fix to normalize copied text from chat messages to plain text, preventing rich-text style leakage into other applications. The implementation adds a copy event listener to the chat messages container, which intercepts the copy action, prevents the default behavior, and sets the clipboard data to plain text only. The logic correctly scopes this functionality to selections within the chat area. A new E2E test is also included, which effectively validates the new behavior by simulating a copy event and asserting that only plain text is added to the (mocked) clipboard. The changes are well-implemented and address the described issue effectively.

Copy link
Copy Markdown
Collaborator

@zmanian zmanian left a comment

Choose a reason for hiding this comment

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

Clean UX fix with thorough E2E testing. The copy handler is properly defensive (null checks, containment check, collapsed selection guard). The second commit improving test determinism shows good attention to flaky-test prevention. LGTM.

@ilblackdragon ilblackdragon merged commit dac4208 into nearai:staging Mar 15, 2026
18 checks passed
@G7CNF G7CNF deleted the codex/issue-1059-plain-copy branch March 15, 2026 14:31
bkutasi pushed a commit to bkutasi/ironclaw that referenced this pull request Mar 28, 2026
* fix(web-chat): force plain-text clipboard copy from chat messages

* test(e2e): make chat copy test target deterministic message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: experienced 6-19 merged PRs risk: medium Business logic, config, or moderate-risk modules scope: channel/web Web gateway channel size: M 50-199 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copied chat text has white font color — invisible when pasted into white-background apps

3 participants