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:
@@ -53,7 +53,7 @@ export const ScrollableOverlay = React.forwardRef<HTMLElement, ScrollableOverlay
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
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",
|
preventOverscroll && "overscroll-none",
|
||||||
outerClassName
|
outerClassName
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -655,6 +655,13 @@ html:not(.dark) .chat-scroll {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Overlay scrollbar styling (custom thumb) */
|
/* 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 {
|
.overlay-scrollbar {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user