Skip to content

refactor: single scrollbar add and named slack in getHeadersWidth - #2717

Merged
ghiscoding merged 1 commit into
masterfrom
refactor/headers-width-slack
Aug 10, 2026
Merged

refactor: single scrollbar add and named slack in getHeadersWidth#2717
ghiscoding merged 1 commit into
masterfrom
refactor/headers-width-slack

Conversation

@ghiscoding

@ghiscoding ghiscoding commented Aug 10, 2026

Copy link
Copy Markdown
Owner

verified by Copilot using GPT-5.3-Codex

Port bug fix from 6pac/SlickGrid PR 6pac/SlickGrid#1274 into slickgrid-universal

Resolves the Q16 investigation item from the quirks triage (discussion 6pac/SlickGrid#1247): getHeadersWidth() added the vertical-scrollbar width to the active band twice — once in the conditional gutter-attribution block (from 6pac/SlickGrid#1260, gated on !autoHeight), and once more, unconditionally, in the band-finalization block. Two generations of code expressing the same intent.

Why the duplicate add contributes nothing

The band widths already carry the classic +1000 fixed slack (applied to the left band and again to the return value), which is what actually guarantees the two invariants the header width serves:

  1. the header band's scroll range covers the body viewport's scroll range (header width is the header/body scroll-sync floor), and
  2. column drag-reorder has room past the last column.

A second ≤17px scrollbar term riding on a 1000px slack cannot be load-bearing. It was also wrong-shaped: the conditional add correctly skips autoHeight grids (which have no vertical scrollbar), while the unconditional one gave them a gutter for a scrollbar that doesn't exist.

The change

  • Exactly one scrollbar add remains — the documented, conditional gutter attribution.
  • The two unconditional duplicate adds are deleted.
  • The 1000 literals are promoted to a named module constant, HEADER_WIDTH_SLACK, with a comment stating what the slack is for — the intent is now explicit rather than folklore.

Net effect on computed widths: the header container gets ≤17px narrower (and autoHeight grids lose the phantom gutter). The container is clipped, and both scroll-range floors retain the full 1000px slack, so nothing is user-visible.

This also simplifies the #1238 rework: the ViewportMgr's computeHeaderWidths currently mirrors the double-add bit-for-bit; after this lands it mirrors one sane formula.

Test

cypress/e2e/headers-width-scroll-sync.cy.ts — a regression pin, not a bug repro (there is no fail-on-unfixed leg, and per that, no temporary example page). Self-hosting harness with three grids — plain, frozenColumn: 1 (right band scrolls), and autoHeight — asserting for each: header scroll range ≥ body scroll range, header scroller reaches the body's scrollLeft at full right scroll (no clamping), and the last column's header stays pixel-aligned with its body cells there. Verified to pass on the pre-change build (baseline) and on the refactored build, so any future width-formula change that breaks scroll sync fails this spec.

Full cypress suite: all specs passed — 652 tests, 650 passing, 2 pre-existing skips (4m51s).

(Quirks-triage follow-up: with this, every actionable item from discussion 6pac/SlickGrid#1247 is resolved on master — remaining entries are the documented keep-as-is decisions and the Q32 product call.)

🤖 Generated with Claude Code

@ghiscoding ghiscoding changed the title efactor: single scrollbar add and named slack in getHeadersWidth refactor: single scrollbar add and named slack in getHeadersWidth Aug 10, 2026
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.0%. Comparing base (e8ca333) to head (de8bcdb).
⚠️ Report is 2 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2717   +/-   ##
=======================================
  Coverage   100.0%   100.0%           
=======================================
  Files         200      200           
  Lines       25515    25507    -8     
  Branches     9024     9012   -12     
=======================================
- Hits        25515    25507    -8     
Flag Coverage Δ
angular 100.0% <ø> (ø)
universal 100.0% <100.0%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pkg-pr-new

pkg-pr-new Bot commented Aug 10, 2026

Copy link
Copy Markdown
angular-slickgrid

npm i https://pkg.pr.new/angular-slickgrid@2717

aurelia-slickgrid

npm i https://pkg.pr.new/aurelia-slickgrid@2717

slickgrid-react

npm i https://pkg.pr.new/slickgrid-react@2717

slickgrid-vue

npm i https://pkg.pr.new/slickgrid-vue@2717

@slickgrid-universal/angular-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/angular-row-detail-plugin@2717

@slickgrid-universal/aurelia-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/aurelia-row-detail-plugin@2717

@slickgrid-universal/react-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/react-row-detail-plugin@2717

@slickgrid-universal/vue-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/vue-row-detail-plugin@2717

@slickgrid-universal/binding

npm i https://pkg.pr.new/@slickgrid-universal/binding@2717

@slickgrid-universal/common

npm i https://pkg.pr.new/@slickgrid-universal/common@2717

@slickgrid-universal/composite-editor-component

npm i https://pkg.pr.new/@slickgrid-universal/composite-editor-component@2717

@slickgrid-universal/custom-footer-component

npm i https://pkg.pr.new/@slickgrid-universal/custom-footer-component@2717

@slickgrid-universal/custom-tooltip-plugin

npm i https://pkg.pr.new/@slickgrid-universal/custom-tooltip-plugin@2717

@slickgrid-universal/empty-warning-component

npm i https://pkg.pr.new/@slickgrid-universal/empty-warning-component@2717

@slickgrid-universal/event-pub-sub

npm i https://pkg.pr.new/@slickgrid-universal/event-pub-sub@2717

@slickgrid-universal/excel-export

npm i https://pkg.pr.new/@slickgrid-universal/excel-export@2717

@slickgrid-universal/graphql

npm i https://pkg.pr.new/@slickgrid-universal/graphql@2717

@slickgrid-universal/odata

npm i https://pkg.pr.new/@slickgrid-universal/odata@2717

@slickgrid-universal/pagination-component

npm i https://pkg.pr.new/@slickgrid-universal/pagination-component@2717

@slickgrid-universal/pdf-export

npm i https://pkg.pr.new/@slickgrid-universal/pdf-export@2717

@slickgrid-universal/row-detail-view-plugin

npm i https://pkg.pr.new/@slickgrid-universal/row-detail-view-plugin@2717

@slickgrid-universal/rxjs-observable

npm i https://pkg.pr.new/@slickgrid-universal/rxjs-observable@2717

@slickgrid-universal/sql

npm i https://pkg.pr.new/@slickgrid-universal/sql@2717

@slickgrid-universal/text-export

npm i https://pkg.pr.new/@slickgrid-universal/text-export@2717

@slickgrid-universal/utils

npm i https://pkg.pr.new/@slickgrid-universal/utils@2717

@slickgrid-universal/vanilla-bundle

npm i https://pkg.pr.new/@slickgrid-universal/vanilla-bundle@2717

@slickgrid-universal/vanilla-force-bundle

npm i https://pkg.pr.new/@slickgrid-universal/vanilla-force-bundle@2717

@slickgrid-universal/web-mcp

npm i https://pkg.pr.new/@slickgrid-universal/web-mcp@2717

commit: de8bcdb

@ghiscoding ghiscoding added the AI label Aug 10, 2026
@ghiscoding
ghiscoding merged commit 8f19df5 into master Aug 10, 2026
17 checks passed
@ghiscoding
ghiscoding deleted the refactor/headers-width-slack branch August 10, 2026 15:03
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.

1 participant