a tool for shared writing and social publishing

tweak scrollinto view behavior

+7 -4
+7 -4
app/lish/[did]/[publication]/[rkey]/Interactions/Interactions.tsx
··· 87 87 let isOffscreen = false; 88 88 if (el) { 89 89 const rect = el.getBoundingClientRect(); 90 - const windowHeight = 91 - window.innerHeight || document.documentElement.clientHeight; 92 90 const windowWidth = 93 91 window.innerWidth || document.documentElement.clientWidth; 94 - isOffscreen = rect.right > windowWidth; 92 + isOffscreen = rect.right > windowWidth - 64; 95 93 } 96 94 97 - if (el && isOffscreen) el.scrollIntoView({ behavior: "smooth" }); 95 + if (el && isOffscreen) 96 + el.scrollIntoView({ 97 + behavior: "smooth", 98 + block: "center", 99 + inline: "center", 100 + }); 98 101 } 99 102 100 103 export const Interactions = (props: {