An answer sized the assistant dock past the bottom of the page because nothing refit the panel after it landed

This commit is contained in:
Gmer4Lfe
2026-08-06 18:36:50 -04:00
parent e467cdaf23
commit 10c1705790
+15 -7
View File
@@ -1192,15 +1192,20 @@ function vvFitRight() {
right.style.height = left.offsetHeight + 'px';
// The assistant dock sits below every view, so its height comes off the space the views get.
// Measured, not assumed — it is one row at rest and taller once an answer is open.
const dock = document.getElementById('vv-ai-dock');
const dockH = dock ? dock.offsetHeight : 0;
const contentH = Math.max(80, lf.getBoundingClientRect().top - 32
- toolbar.getBoundingClientRect().bottom - dockH);
// Cap the conversation at roughly 40% of the panel and let it scroll internally, so a long
// answer shrinks the view above by a bounded amount instead of swallowing it.
// The cap comes off the space available before the dock is measured, not after. Deriving it
// from a figure the dock's own height had already been subtracted from fed the dock back into
// its own limit: one long answer drove the subtraction to its floor, which drove the cap to
// its floor, and nothing ever raised it again.
const availH = Math.max(80, lf.getBoundingClientRect().top - 32
- toolbar.getBoundingClientRect().bottom);
const dockBody = document.getElementById('vv-ai-dock-body');
if (dockBody) dockBody.style.maxHeight = Math.max(90, Math.round(contentH * 0.4)) + 'px';
if (dockBody) dockBody.style.maxHeight = Math.max(90, Math.round(availH * 0.4)) + 'px';
// Measured after the cap is applied, so this reads the clamped height, not the natural one.
const dock = document.getElementById('vv-ai-dock');
const dockH = dock ? dock.offsetHeight : 0;
const contentH = Math.max(80, availH - dockH);
if (pre.style.display !== 'none') {
pre.style.maxHeight = 'none';
pre.style.height = contentH + 'px';
@@ -2333,10 +2338,13 @@ function vvAiDockScope(profile, label, target) {
}
}
// Anything that changes what is in the dock has to re-run the fit, or the dock keeps the height
// the new content wants and pushes the panel past the bottom of the page.
function vvAiDockAppend(html) {
const body = document.getElementById('vv-ai-dock-body');
body.insertAdjacentHTML('beforeend', html);
body.scrollTop = body.scrollHeight;
requestAnimationFrame(vvFitRight);
}
function vvAiDockExpand() {
@@ -2473,7 +2481,7 @@ function vvAiDockDone(text, isErr, sources) {
// Offered only once there is something to attach a fix to.
if (!isErr && vvAiLastQ) document.getElementById('vv-ai-dock-fix').style.display = '';
const body = document.getElementById('vv-ai-dock-body');
body.scrollTop = body.scrollHeight;
requestAnimationFrame(() => { vvFitRight(); body.scrollTop = body.scrollHeight; });
}
// ── Advanced mode toggle ──────────────────────────────────────────────────────