show less btn fix

3clyp50 committed Jan 29, 2026 at 17:18 UTC 561165b17c006feb4e253365e23431b2877ceebc
2 files changed +10 -5
webui/components/messages/action-buttons/simple-action-buttons.css
+1 -1
@@ -15,7 +15,7 @@
15 }
16
17 .step-action-buttons .expand-btn {
18 - display: inline-flex;
18 + display: none;
19 align-items: center;
20 background: transparent;
21 border: none;
webui/js/messages.js
+9 -4
@@ -2067,10 +2067,15 @@ function setupCollapsible(messageDiv, containerSelector, initialExpanded, action
2067 if (!messageDiv.classList.contains("has-overflow")) {
2068 requestAnimationFrame(() => {
2069 const body = messageDiv.querySelector(".message-body");
2070 - const wasExp = messageDiv.classList.contains("expanded");
2071 - messageDiv.classList.remove("expanded");
2072 - messageDiv.classList.toggle("has-overflow", body?.scrollHeight > body?.clientHeight);
2073 - messageDiv.classList.toggle("expanded", wasExp);
2070 + if (!body) return;
2071 +
2072 + // calculate max height without touching DOM (no scroll jitter)
2073 + const fontSize = parseFloat(getComputedStyle(body).fontSize || "16");
2074 + const maxHeight = messageDiv.classList.contains("expanded")
2075 + ? fontSize * 15
2076 + : body.clientHeight;
2077 +
2078 + messageDiv.classList.toggle("has-overflow", body.scrollHeight > maxHeight);
2079 });
2080 }
2081 }