From 09fb555ec715c2850931ce119e4b84da7964a3c3 Mon Sep 17 00:00:00 2001 From: Alessandro <155005371+3clyp50@users.noreply.github.com> Date: Wed, 1 Jul 2026 16:27:08 +0200 Subject: [PATCH] Prevent selecting message action buttons Mark message action button chrome as non-selectable so copy/paste captures message text without toolbar icon labels. Add a static regression for the shared action-buttons stylesheet. --- tests/test_message_action_buttons_static.py | 17 +++++++++++++++++ webui/components/messages/AGENTS.md | 1 + .../action-buttons/simple-action-buttons.css | 1 + 3 files changed, 19 insertions(+) create mode 100644 tests/test_message_action_buttons_static.py diff --git a/tests/test_message_action_buttons_static.py b/tests/test_message_action_buttons_static.py new file mode 100644 index 000000000..dfb048a84 --- /dev/null +++ b/tests/test_message_action_buttons_static.py @@ -0,0 +1,17 @@ +from pathlib import Path + + +PROJECT_ROOT = Path(__file__).resolve().parents[1] + + +def test_message_action_buttons_are_not_text_selectable() -> None: + css = PROJECT_ROOT.joinpath( + "webui", + "components", + "messages", + "action-buttons", + "simple-action-buttons.css", + ).read_text(encoding="utf-8") + + block = css[css.index(".step-action-buttons {"):css.index("}", css.index(".step-action-buttons {"))] + assert "user-select: none;" in block diff --git a/webui/components/messages/AGENTS.md b/webui/components/messages/AGENTS.md index 78c340802..4fa8542ec 100644 --- a/webui/components/messages/AGENTS.md +++ b/webui/components/messages/AGENTS.md @@ -15,6 +15,7 @@ - Keep message DOM helpers compatible with extension points that modify rendered messages. - Sanitize or safely render model/user-provided content through shared rendering paths. - Avoid layout shifts that break long-running message streaming. +- Keep message action chrome out of text selection so copy/paste captures message content without button labels or icons. ## Work Guidance diff --git a/webui/components/messages/action-buttons/simple-action-buttons.css b/webui/components/messages/action-buttons/simple-action-buttons.css index a5b197beb..1d29919ca 100644 --- a/webui/components/messages/action-buttons/simple-action-buttons.css +++ b/webui/components/messages/action-buttons/simple-action-buttons.css @@ -12,6 +12,7 @@ opacity: 0; transition: opacity 0.2s ease-in-out; pointer-events: none; + user-select: none; } .step-action-buttons .expand-btn {