Skip to content

fix: keep the borders on fixed pivot table headers when scrolling (DHIS2-22539) - #1881

Merged
janhenrikoverland merged 2 commits into
masterfrom
fix/pivot-table-fixed-header-borders-DHIS2-22539
Nov 19, 2026
Merged

janhenrikoverland merged 2 commits into
masterfrom
fix/pivot-table-fixed-header-borders-DHIS2-22539

Conversation

@janhenrikoverland

@janhenrikoverland janhenrikoverland commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Implements DHIS2-22539

Relates to dhis2/individual-data-visualizer-app#465


Key features

  1. Fixed column headers keep their top border when the table is scrolled down
  2. Fixed row headers keep their left border when the table is scrolled sideways
  3. Title, subtitle and filter rows keep their left border when a table with fixed row headers is scrolled sideways

Description

With fixed headers, the table's outer border was partly drawn by the table itself or by its first header row. Those scroll away, so a fixed header was left without a border on the edge it sticks to:

  • Top: the top border was on the first row of the thead. That is a title row whenever there is a title, subtitle or filter, and title rows are not fixed. Once they scrolled out, the column headers had no top border.
  • Left: the left border was on the table. Once the table was scrolled sideways, the row headers had no left border.

The headers on the edge now carry the border themselves:

  • The headers in the first column header row get the class top-edge-header, and the outermost row headers get left-edge-header. The corner cell gets both.
  • With fixed column headers, a title row has its border on top instead of below, and the top-edge headers have a top border. That keeps a single line between the title rows and the column headers.
  • With fixed row headers, the table no longer has a left border. The left-edge headers have it instead.
  • A title cell spans the whole table and is not fixed, so a left border of its own would scroll away too. Its content sticks to the left edge of the table container and carries the border.

How the title follows sideways scrolling. The title content used to be moved with a margin-left set from the debounced scroll position. A border on it would lag behind the fixed row headers, so the content now uses position: sticky instead. Two things follow from that:

  • The title cell no longer hides its overflow. A cell that does becomes the scroll container of its sticky content, and the content would not follow the table. The content element still clips its own text.
  • PivotTableTitleRow no longer takes a scrollPosition prop.

This applies to every pivot table, not only those with fixed headers: the title follows the scroll through CSS instead of script.

The borders are unchanged when no headers are fixed. Unscrolled, a table with fixed headers looks the same as before, apart from a 1px shift to the left with fixed row headers, where the left border moved from the table into the cells.

Checked in Storybook (Chrome) with fixed column headers, fixed row headers and both, each unscrolled and scrolled down, sideways and both ways, on these stories: deep, deep with title/subtitle/filter, deep with dimension labels, all totals, hierarchy in rows, no columns, no rows. Every header on the top or left edge has its border, and no border is doubled.

The title row change was checked on the deep with title/subtitle/filter story, scrolled sideways: the title content stays at the left edge of the container with no headers fixed, with either one fixed and with both, and it has the left border with fixed row headers and with both.


TODO

  • Tests added
  • PRs for all affected apps created (apps pick this up with the next version bump)
  • Storybook added (the existing PivotTable stories have the two fixed header checkboxes)

Known issues

  • The unit test only checks which cells get the two edge classes, and that the title content sits directly in the title cell. jsdom does not apply the styled-jsx styles, so the borders themselves were checked in the browser.
  • The sticky title was checked in Chrome only, and not with a title long enough to be truncated.

🤖 Generated with Claude Code

…IS2-22539)

A border on the table scrolls away with the table, so a fixed header had
no border on the edge it sticks to:

- no top border on fixed column headers once a title, subtitle or filter
  row had scrolled out of view
- no left border on fixed row headers once the table was scrolled sideways

The headers on the top and left edge now carry those borders themselves.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
janhenrikoverland added a commit to dhis2/individual-data-visualizer-app that referenced this pull request Nov 18, 2026
…2-22539]

The border is fixed in the pivot table engine instead, for both the
column and the row headers: dhis2/analytics#1881

This reverts commit 429408e.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…HIS2-22539)

A title, subtitle or filter row spans the whole table, so its left border
scrolled away with the table while the fixed row headers below kept theirs.

The title content now sticks to the left edge of the table container and
carries the left border itself when the row headers are fixed. This
replaces the margin that was set from the debounced scroll position, which
would have let the border lag behind the fixed headers.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@janhenrikoverland
janhenrikoverland marked this pull request as draft November 18, 2026 16:15
HendrikThePendric added a commit to dhis2/individual-data-visualizer-app that referenced this pull request Nov 19, 2026
* feat: add fixed headers options to pivot tables [DHIS2-22539]

Add "Fix column headers to top of table" and "Fix row headers to left of
table" to the Style tab of the pivot table options, as in Data Visualizer.
The pivot table engine reads both from the visualization, and the
eventVisualizations API persists them since 2.43.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix: keep the top border on fixed pivot table column headers [DHIS2-22539]

The pivot table engine draws the top border on the first header row only.
In this app that is a title row, which scrolls away under fixed column
headers and takes the border with it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* revert: keep the top border on fixed pivot table column headers [DHIS2-22539]

The border is fixed in the pivot table engine instead, for both the
column and the row headers: dhis2/analytics#1881

This reverts commit 429408e.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Hendrik de Graaf <HendrikThePendric@users.noreply.github.com>

@HendrikThePendric HendrikThePendric left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from being a concrete bugfix, it's also a nice UX and technical improvement. Using sticky positioning means letting the browser do some work we used to manually do. Since that manual work used to be based on a debounced scroll position, while the sticky positioning is instant, it should/could make the UX more responsive too.

@HendrikThePendric

HendrikThePendric commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

@janhenrikoverland our dependabot PRs in IDV appear weekly, so if you want this fix into the app today you need to put up a PR there too

@janhenrikoverland
janhenrikoverland marked this pull request as ready for review November 19, 2026 13:29
@janhenrikoverland
janhenrikoverland merged commit cb5ee79 into master Nov 19, 2026
13 checks passed
@janhenrikoverland
janhenrikoverland deleted the fix/pivot-table-fixed-header-borders-DHIS2-22539 branch November 19, 2026 13:29
dhis2-bot added a commit that referenced this pull request Nov 19, 2026
## [29.10.1](v29.10.0...v29.10.1) (2026-11-19)

### Bug Fixes

* keep the borders on fixed pivot table headers when scrolling (DHIS2-22539) ([#1881](#1881)) ([cb5ee79](cb5ee79))
@dhis2-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 29.10.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants