fix: budget dock height for answer controls and toolbar

This commit is contained in:
anikam13
2026-10-26 23:03:09 -07:00
parent 3dc88472ee
commit 42814ba6a6
3 changed files with 16 additions and 4 deletions
+14 -2
View File
@@ -2026,11 +2026,23 @@ function DockOverlay({
if (!el) return;
const measure = () => {
setSbInset(Math.round((el.offsetWidth - el.clientWidth) / 2));
setDockMaxH(Math.max(el.clientHeight - 32, 160));
const block = blockRef.current;
const question = block?.querySelector<HTMLElement>("[data-dock-scroll-area]");
// The height budget belongs to the whole dock, including answer
// controls, stats, and padding. Only the question may consume the
// remaining space; otherwise the overlay grows behind the header.
const chrome = block && question ? block.offsetHeight - question.offsetHeight : 0;
setDockMaxH(Math.max(el.clientHeight - 32 - chrome, 0));
};
measure();
const observer = new ResizeObserver(measure);
observer.observe(el);
if (blockRef.current) observer.observe(blockRef.current);
window.addEventListener("resize", measure);
return () => window.removeEventListener("resize", measure);
return () => {
observer.disconnect();
window.removeEventListener("resize", measure);
};
}, [scrollRef]);
// GROWTH MUTE (owner round, 2026-10-05 — the generation churn): during a