Skip to content

fix: account for the vertical scrollbar in column widths - #907

Merged
spike-rabbit merged 2 commits into
siemens:mainfrom
JohnTrunix:fix/scrollbar-column-width
Nov 26, 2026
Merged

spike-rabbit merged 2 commits into
siemens:mainfrom
JohnTrunix:fix/scrollbar-column-width

Conversation

@JohnTrunix

@JohnTrunix JohnTrunix commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

What kind of change does this PR introduce? (check one with "x")

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior? (You can also link to an open issue here)

Closes #906

What is the new behavior?

  • The table width comes from the scroll container's content box (via the existing ResizeObserver), so it excludes a visible vertical scrollbar and the columns are recalculated whenever the scrollbar appears or disappears.
  • The force mode distribution repeats until no column is clamped to its min or max width, so the remaining columns absorb the delta.
  • Whether force mode columns bleed is decided with the actual scrollbar width of the scroll container. The now unused ScrollbarHelper and verticalScrollVisible inputs are removed.
  • Horizontal overflow is hidden when only vertical scrolling is enabled.
  • Ghost loading only fills fully visible rows, and the last rendered row index is clamped to the row count.
  • The ghost loader overlay (external paging) takes the body's CSS height, so it clips the rows that do not fit.

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

The PR is split into two commits: the scrollbar and column width fix, and the ghost row overflow fix.

The resizing specs force a real 15px scrollbar (headless Chromium runs with --hide-scrollbars), and the previously skipped BUG assertions are enabled.

@JohnTrunix
JohnTrunix requested a review from a team as a code owner November 25, 2026 13:43
@JohnTrunix
JohnTrunix marked this pull request as draft November 25, 2026 13:51
@JohnTrunix
JohnTrunix force-pushed the fix/scrollbar-column-width branch from 8b08c0a to dd6b7d4 Compare November 25, 2026 13:56
@JohnTrunix
JohnTrunix marked this pull request as ready for review November 25, 2026 14:03
@JohnTrunix

Copy link
Copy Markdown
Member Author

@siemens__ngx-datatable.patch

As a reference, initially we let Claude write a patch which resolved our issue. It was the starting point for this PR...

@ljanner
ljanner requested a review from spike-rabbit November 25, 2026 14:55

@spike-rabbit spike-rabbit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank so much for your contribution @JohnTrunix. I was having a rough look, and let my agent provide some feedback.

@JohnTrunix
JohnTrunix force-pushed the fix/scrollbar-column-width branch 2 times, most recently from a9559b8 to 7be66dd Compare November 26, 2026 11:14
Measure the table width from the scroll container, excluding a visible
vertical scrollbar, and recalculate the columns whenever the scrollbar
appears or disappears. Previously the last column was cut off and a
horizontal scrollbar appeared when the scrollbar showed up after load.

Repeat the force mode distribution until no column is clamped to its
min or max width, so the remaining columns absorb the delta. Use the
actual scrollbar width of the scroll container to decide whether the
columns bleed. Hide the horizontal overflow when only vertical
scrolling is enabled.
Only fill the fully visible rows with ghost rows and clamp the last
rendered row index to the row count, so ghost loading no longer causes
a vertical scrollbar. Apply the body height to the ghost loader
overlay, so that it clips the rows that do not fit.
@JohnTrunix
JohnTrunix force-pushed the fix/scrollbar-column-width branch from 7be66dd to 4177f57 Compare November 26, 2026 11:57
@JohnTrunix JohnTrunix changed the title Horizontal scrollbar and cut-off last column after load without scrollbarH fix: account for the vertical scrollbar in column widths Nov 26, 2026

@spike-rabbit spike-rabbit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💯 looks good, works well. Thanks a lot for your contribution.

I will also backport it to the v27 branch so it should be released tomorrow, the latest next week.

@spike-rabbit
spike-rabbit added this pull request to the merge queue Nov 26, 2026
Merged via the queue into siemens:main with commit 248c3a7 Nov 26, 2026
3 checks passed
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.

[BUG]: Horizontal scrollbar and cut-off last column after load without scrollbarH (regression in 27)

2 participants