Skip to content

Commit 54692c5

Browse files
committed
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.
1 parent 8cd6ff1 commit 54692c5

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from pathlib import Path
2+
3+
4+
PROJECT_ROOT = Path(__file__).resolve().parents[1]
5+
6+
7+
def test_message_action_buttons_are_not_text_selectable() -> None:
8+
css = PROJECT_ROOT.joinpath(
9+
"webui",
10+
"components",
11+
"messages",
12+
"action-buttons",
13+
"simple-action-buttons.css",
14+
).read_text(encoding="utf-8")
15+
16+
block = css[css.index(".step-action-buttons {"):css.index("}", css.index(".step-action-buttons {"))]
17+
assert "user-select: none;" in block

webui/components/messages/AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- Keep message DOM helpers compatible with extension points that modify rendered messages.
1616
- Sanitize or safely render model/user-provided content through shared rendering paths.
1717
- Avoid layout shifts that break long-running message streaming.
18+
- Keep message action chrome out of text selection so copy/paste captures message content without button labels or icons.
1819

1920
## Work Guidance
2021

webui/components/messages/action-buttons/simple-action-buttons.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
opacity: 0;
1313
transition: opacity 0.2s ease-in-out;
1414
pointer-events: none;
15+
user-select: none;
1516
}
1617

1718
.step-action-buttons .expand-btn {

0 commit comments

Comments
 (0)