Skip to content

Fix frozen rows layout by restoring line break separator#4902

Merged
azmy60 merged 6 commits into
masterfrom
claude/issue-4871-failing-tests-L3U33
Jun 30, 2026
Merged

Fix frozen rows layout by restoring line break separator#4902
azmy60 merged 6 commits into
masterfrom
claude/issue-4871-failing-tests-L3U33

Conversation

@rathboma

Copy link
Copy Markdown
Collaborator

Fix #4871

Summary

Restores the <br> element that was removed in PR #4809 between the column headers and the frozen rows holder. This separator is necessary for correct layout when both elements are display: inline-block.

Changes

  • src/js/modules/FrozenRows/FrozenRows.js: Re-added fragment.appendChild(document.createElement("br")) in initialize() with updated comment explaining why it's needed for inline-block layout
  • src/scss/tabulator.scss: Removed the padding-top: 1em workaround that was added in PR SASS upgrade - and extra header row removed #4809, as it was an incomplete fix for the layout issue
  • test/unit/modules/FrozenRows.spec.js: Added regression test verifying the <br> separator is present in the DOM
  • test/unit/modules/FrozenRowsIntegration.spec.js: Added integration tests covering both row.freeze() and frozenRows option initialization paths
  • test/e2e/frozen-rows.spec.js: Added Playwright e2e test validating that frozen rows remain pinned above the scrollable body during scroll
  • test/e2e/frozen-rows.html: Added test fixture HTML page for e2e testing
  • CLAUDE.md: Added project conventions documentation

Implementation Details

The frozen rows holder and column headers are both display: inline-block elements. Without a structural separator between them, the holder collapses inline with the headers instead of rendering on a new line below them. This caused frozen rows to be clipped and not appear pinned above the scrollable body.

The <br> element forces the inline-block holder onto its own row, restoring the correct visual layout. The padding-top workaround was insufficient because it didn't address the underlying inline-block layout issue.

Tests cover the fix at three levels:

  • Unit test validates DOM structure (pure unit test)
  • Integration test validates behavior with real table initialization
  • E2e test validates actual browser layout and scroll behavior

https://claude.ai/code/session_01U9KrvQH7MRRQ6Z2xShhuKb

claude and others added 6 commits May 24, 2026 19:48
Reproduces the regression where freezing a row no longer pins it above
the scrollable body. PR #4809 removed the <br> that separated the
inline-block frozen-rows-holder from the column headers; without it the
holder collapses next to the headers and the frozen row is no longer
visible at the top.

Adds one unit test (initialize() inserts a <br> before topElement) and
two integration tests using TabulatorFull that assert the rendered
holder's previousSibling is a <br>, covering both row.freeze() and the
frozenRows table option.
PR #4809 removed the <br> that the FrozenRows initializer used to insert
between the column headers and the frozen-rows-holder, and tried to
replace it with padding-top: 1em on the holder. That doesn't work
because both .tabulator-headers and .tabulator-frozen-rows-holder are
display: inline-block, so without a line break the holder sits next to
the headers instead of below them, and frozen rows are no longer
visible at the top of the table.

Restore the <br> and drop the unused padding-top.
Codify the practice of dropping the issue URL alongside both the code
that fixes the bug and the regression test that covers it, so future
readers can trace any line back to the original report.

Also apply the convention retroactively to the FrozenRows #4871 fix.
Add repo layout, common commands, testing patterns (pure-unit vs
TabulatorFull integration, the createDocumentFragment / Module
prototype pollution gotcha, jsdom layout caveat), and build notes
alongside the existing bug-fix issue link convention.
…4871)

jsdom can't observe layout, so the unit tests only verify the structural
fix (presence of the <br> separator). This Playwright spec loads a
50-row table with frozenRows: 1 in a real browser and asserts:

  - the frozen row is laid out at the same x as the body (with the bug
    it's pushed ~1200px to the right of the inline-block headers and
    clipped by the header's overflow:hidden, which is what the user
    reported as "the row is not frozen")
  - scrolling the body actually moves the body rows
  - the frozen row's screen position is unchanged after scrolling

Verified the test passes with the fix and fails without it (the left-
edge assertion catches the off-screen layout: expected <5, got 1224).
@azmy60 azmy60 merged commit 36b229e into master Jun 30, 2026
11 checks passed
@azmy60 azmy60 deleted the claude/issue-4871-failing-tests-L3U33 branch June 30, 2026 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Freezing a row no longer works;

3 participants