fix: prevent overlay scrollbar from shifting content

Reserves scrollbar space in overlay overlays when the thumb appears
Keeps text and layout from jumping on hover
Avoids double-reserving space for nested scrollers
This commit is contained in:
Bohdan Triapitsyn
2026-09-08 00:45:12 +03:00
parent a333fa9c34
commit 6ba9125635
2 changed files with 8 additions and 1 deletions
@@ -53,7 +53,7 @@ export const ScrollableOverlay = React.forwardRef<HTMLElement, ScrollableOverlay
return (
<div
className={cn(
"relative flex flex-col min-h-0 w-full overflow-hidden",
"overlay-scrollbar-wrapper relative flex flex-col min-h-0 w-full overflow-hidden",
preventOverscroll && "overscroll-none",
outerClassName
)}
+7
View File
@@ -655,6 +655,13 @@ html:not(.dark) .chat-scroll {
}
/* Overlay scrollbar styling (custom thumb) */
/* Reserve the thumb's 6px width, 4px right inset and a 4px content gap.
Follow overflow, not hover visibility, so showing the thumb never shifts text.
Direct-child matching prevents nested scrollers from reserving space twice. */
.overlay-scrollbar-wrapper:has(> .overlay-scrollbar > .overlay-scrollbar__thumb--vertical:not([hidden])) {
padding-right: 6px;
}
.overlay-scrollbar {
position: absolute;
inset: 0;