Skip to content

Commit cfb8c78

Browse files
committed
fix: Table chart types headers are offset from the columns in the table
1 parent 66afdfd commit cfb8c78

File tree

1 file changed

+11
-3
lines changed
  • superset-frontend/plugins/plugin-chart-table/src/DataTable/hooks

1 file changed

+11
-3
lines changed

superset-frontend/plugins/plugin-chart-table/src/DataTable/hooks/useSticky.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ function StickyWrap({
166166
const scrollBodyRef = useRef<HTMLDivElement>(null); // main body
167167

168168
const scrollBarSize = getScrollBarSize();
169-
const { bodyHeight, columnWidths } = sticky;
169+
const { bodyHeight, columnWidths, hasVerticalScroll } = sticky;
170170
const needSizer =
171171
!columnWidths ||
172172
sticky.width !== maxWidth ||
@@ -283,13 +283,18 @@ function StickyWrap({
283283
</colgroup>
284284
);
285285

286+
const headerContainerWidth = hasVerticalScroll
287+
? maxWidth - scrollBarSize
288+
: maxWidth;
289+
286290
headerTable = (
287291
<div
288292
key="header"
289293
ref={scrollHeaderRef}
290294
style={{
291295
overflow: 'hidden',
292-
scrollbarGutter: 'stable',
296+
width: headerContainerWidth,
297+
boxSizing: 'border-box',
293298
}}
294299
role="presentation"
295300
>
@@ -309,7 +314,8 @@ function StickyWrap({
309314
ref={scrollFooterRef}
310315
style={{
311316
overflow: 'hidden',
312-
scrollbarGutter: 'stable',
317+
width: headerContainerWidth,
318+
boxSizing: 'border-box',
313319
}}
314320
role="presentation"
315321
>
@@ -339,6 +345,8 @@ function StickyWrap({
339345
height: bodyHeight,
340346
overflow: 'auto',
341347
scrollbarGutter: 'stable',
348+
width: maxWidth,
349+
boxSizing: 'border-box',
342350
}}
343351
css={scrollBarStyles}
344352
onScroll={sticky.hasHorizontalScroll ? onScroll : undefined}

0 commit comments

Comments
 (0)