Skip to content

Agent Zero AI framework

Prevent selecting message action buttons

Alessandro09fb555ec715
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 {