mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-06 19:35:44 +02:00
fix top margin
This commit is contained in:
parent
5965e96f32
commit
a273d0e8b7
1 changed files with 6 additions and 2 deletions
|
|
@ -81,16 +81,20 @@ export const Conversation = ({
|
||||||
|
|
||||||
spacer.style.height = "0px";
|
spacer.style.height = "0px";
|
||||||
|
|
||||||
|
const contentPaddingTop = Number.parseFloat(
|
||||||
|
window.getComputedStyle(content).paddingTop || "0"
|
||||||
|
);
|
||||||
const anchorTop = anchor.offsetTop;
|
const anchorTop = anchor.offsetTop;
|
||||||
|
const targetScrollTop = Math.max(0, anchorTop - contentPaddingTop);
|
||||||
const requiredSlack = Math.max(
|
const requiredSlack = Math.max(
|
||||||
0,
|
0,
|
||||||
anchorTop - (content.scrollHeight - container.clientHeight)
|
targetScrollTop - (content.scrollHeight - container.clientHeight)
|
||||||
);
|
);
|
||||||
|
|
||||||
spacer.style.height = `${Math.ceil(requiredSlack)}px`;
|
spacer.style.height = `${Math.ceil(requiredSlack)}px`;
|
||||||
|
|
||||||
if (scrollToAnchor) {
|
if (scrollToAnchor) {
|
||||||
container.scrollTop = anchorTop;
|
container.scrollTop = targetScrollTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateBottomState();
|
updateBottomState();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue