fix: Table chart types headers are offset from the columns in the table (#36190)

Co-authored-by: Diego Pucci <diegopucci.me@gmail.com>
This commit is contained in:
Enzo Martellucci
2025-11-24 19:25:55 +01:00
committed by GitHub
parent bf2cef7d87
commit ab8352ee66

View File

@@ -166,7 +166,7 @@ function StickyWrap({
const scrollBodyRef = useRef<HTMLDivElement>(null); // main body
const scrollBarSize = getScrollBarSize();
const { bodyHeight, columnWidths } = sticky;
const { bodyHeight, columnWidths, hasVerticalScroll } = sticky;
const needSizer =
!columnWidths ||
sticky.width !== maxWidth ||
@@ -283,13 +283,18 @@ function StickyWrap({
</colgroup>
);
const headerContainerWidth = hasVerticalScroll
? maxWidth - scrollBarSize
: maxWidth;
headerTable = (
<div
key="header"
ref={scrollHeaderRef}
style={{
overflow: 'hidden',
scrollbarGutter: 'stable',
width: headerContainerWidth,
boxSizing: 'border-box',
}}
role="presentation"
>
@@ -309,7 +314,8 @@ function StickyWrap({
ref={scrollFooterRef}
style={{
overflow: 'hidden',
scrollbarGutter: 'stable',
width: headerContainerWidth,
boxSizing: 'border-box',
}}
role="presentation"
>
@@ -339,6 +345,8 @@ function StickyWrap({
height: bodyHeight,
overflow: 'auto',
scrollbarGutter: 'stable',
width: maxWidth,
boxSizing: 'border-box',
}}
css={scrollBarStyles}
onScroll={sticky.hasHorizontalScroll ? onScroll : undefined}