fix top margin

This commit is contained in:
Arjun 2026-04-07 07:39:12 +05:30
parent 5965e96f32
commit a273d0e8b7

View file

@ -81,16 +81,20 @@ export const Conversation = ({
spacer.style.height = "0px";
const contentPaddingTop = Number.parseFloat(
window.getComputedStyle(content).paddingTop || "0"
);
const anchorTop = anchor.offsetTop;
const targetScrollTop = Math.max(0, anchorTop - contentPaddingTop);
const requiredSlack = Math.max(
0,
anchorTop - (content.scrollHeight - container.clientHeight)
targetScrollTop - (content.scrollHeight - container.clientHeight)
);
spacer.style.height = `${Math.ceil(requiredSlack)}px`;
if (scrollToAnchor) {
container.scrollTop = anchorTop;
container.scrollTop = targetScrollTop;
}
updateBottomState();