You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/09/05 02:07:15 UTC
(superset) branch fix/issue-43352-implement-dosu-s-fix-in-superset-fronten created (now 12f7e6859c6)
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a change to branch fix/issue-43352-implement-dosu-s-fix-in-superset-fronten
in repository https://gitbox.apache.org/repos/asf/superset.git
at 12f7e6859c6 fix(plugin-chart-pivot-table): sticky-position row labels and corner header cells
This branch includes the following new commits:
new 12f7e6859c6 fix(plugin-chart-pivot-table): sticky-position row labels and corner header cells
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(superset) 01/01: fix(plugin-chart-pivot-table): sticky-position row labels and corner header cells
Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch fix/issue-43352-implement-dosu-s-fix-in-superset-fronten
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 12f7e6859c6c31cc5a20837594ab7f44e1bfaa52
Author: rusackas <ev...@rusackas.com>
AuthorDate: Fri Sep 4 19:06:46 2026 -0700
fix(plugin-chart-pivot-table): sticky-position row labels and corner header cells
Column headers and row totals already stick via CSS, but the row-label
column and the corner cell(s) above it stayed static, so they scrolled
out of view on wide/tall pivot tables. Add position: sticky; left: 0 to
.pvtRowLabel and a combined top+left rule (with a higher z-index) for
the corner cell(s), gated by the same isDashboardEditMode flag as the
existing sticky rules.
Scoped to single-level row headers (fixed left offset); multi-level row
headers need a per-column inline left style in TableRenderers.tsx,
left as a fast-follow per the discussion on #43352.
Fixes #43352
---
.../src/react-pivottable/Styles.ts | 18 +++++
.../test/react-pivottable/Styles.test.tsx | 91 ++++++++++++++++++++++
2 files changed, 109 insertions(+)
diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/Styles.ts b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/Styles.ts
index 336e3df3a0e..c000fb56dab 100644
--- a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/Styles.ts
+++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/Styles.ts
@@ -39,6 +39,20 @@ export const Styles = styled.div<{ isDashboardEditMode: boolean }>`
top: 0;
}
+ /* Corner cell(s) sitting above the frozen row-label column: the
+ * placeholder cell spanning the column-attribute rows, and the
+ * row-attribute name cell(s) in the final header row. Needs a
+ * higher z-index than .pvtRowLabel so it stays on top when both
+ * stick at the same scroll position. */
+ table.pvtTable thead tr:first-of-type th[aria-hidden='true'],
+ table.pvtTable thead tr:last-of-type th.pvtAxisLabel {
+ position: ${isDashboardEditMode ? 'inherit' : 'sticky'};
+ top: 0;
+ left: 0;
+ z-index: 2;
+ background-color: ${theme.colorBgBase};
+ }
+
table tbody tr {
font-feature-settings: 'tnum' 1;
}
@@ -120,6 +134,10 @@ export const Styles = styled.div<{ isDashboardEditMode: boolean }>`
table.pvtTable tbody tr th.pvtRowLabel {
vertical-align: baseline;
+ position: ${isDashboardEditMode ? 'inherit' : 'sticky'};
+ left: 0;
+ z-index: 1;
+ background-color: ${theme.colorBgBase};
}
table.pvtTable tbody tr th.pvtRowLabel.pvtRowLabelLast {
diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/test/react-pivottable/Styles.test.tsx b/superset-frontend/plugins/plugin-chart-pivot-table/test/react-pivottable/Styles.test.tsx
new file mode 100644
index 00000000000..553171d3f5c
--- /dev/null
+++ b/superset-frontend/plugins/plugin-chart-pivot-table/test/react-pivottable/Styles.test.tsx
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import '@testing-library/jest-dom';
+import { render } from '@testing-library/react';
+import PivotTableChart from '../../src/PivotTableChart';
+import transformProps from '../../src/plugin/transformProps';
+import testData from '../testData';
+import { ProviderWrapper } from '../testHelpers';
+
+test('sticky-positions the row-label column and its corner header cell(s) so they stay visible while scrolling', () => {
+ const transformedProps = {
+ ...transformProps(testData.withoutColTotals),
+ margin: 32,
+ legacy_order_by: null,
+ order_desc: false,
+ };
+ const { container } = render(
+ ProviderWrapper({
+ children: <PivotTableChart {...transformedProps} />,
+ }),
+ );
+
+ const rowLabelCell = container.querySelector('tbody th.pvtRowLabel');
+ expect(rowLabelCell).toBeInTheDocument();
+ const rowLabelStyle = getComputedStyle(rowLabelCell as Element);
+ expect(rowLabelStyle.position).toBe('sticky');
+ expect(rowLabelStyle.left).toBe('0px');
+
+ // The corner cell(s) above the frozen row-label column (the padding
+ // placeholder and/or the row-attribute name cell in the last header
+ // row) must stick on both axes with a higher z-index than the row
+ // label column, so they stay on top at the intersection.
+ const cornerCells = [
+ ...container.querySelectorAll(
+ "thead tr:first-of-type th[aria-hidden='true']",
+ ),
+ ...container.querySelectorAll('thead tr:last-of-type th.pvtAxisLabel'),
+ ];
+ expect(cornerCells.length).toBeGreaterThan(0);
+ cornerCells.forEach(cell => {
+ const style = getComputedStyle(cell);
+ expect(style.position).toBe('sticky');
+ expect(style.top).toBe('0px');
+ expect(style.left).toBe('0px');
+ expect(Number(style.zIndex)).toBeGreaterThan(Number(rowLabelStyle.zIndex));
+ });
+});
+
+test('does not sticky-position the row-label column or corner cell(s) in dashboard edit mode', () => {
+ // TableRenderers detects dashboard edit mode by looking for this class
+ // on the document, rather than via a prop.
+ const editingMarker = document.createElement('div');
+ editingMarker.className = 'dashboard--editing';
+ document.body.appendChild(editingMarker);
+
+ try {
+ const transformedProps = {
+ ...transformProps(testData.withoutColTotals),
+ margin: 32,
+ legacy_order_by: null,
+ order_desc: false,
+ };
+ const { container } = render(
+ ProviderWrapper({
+ children: <PivotTableChart {...transformedProps} />,
+ }),
+ );
+
+ const rowLabelCell = container.querySelector('tbody th.pvtRowLabel');
+ expect(rowLabelCell).toBeInTheDocument();
+ expect(getComputedStyle(rowLabelCell as Element).position).toBe('inherit');
+ } finally {
+ editingMarker.remove();
+ }
+});