From 825d1097f424bc8da31dc7758a5711de40452a4f Mon Sep 17 00:00:00 2001 From: ghiscoding Date: Tue, 28 Jul 2026 22:12:18 -0400 Subject: [PATCH 1/2] refactor: replace getHeadersWidth's out-of-range loop-index probe with hasFrozenColumns() --- packages/common/src/core/slickGrid.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/common/src/core/slickGrid.ts b/packages/common/src/core/slickGrid.ts index 46c31047d..ae4cd558e 100755 --- a/packages/common/src/core/slickGrid.ts +++ b/packages/common/src/core/slickGrid.ts @@ -1258,9 +1258,7 @@ export class SlickGrid = Column, O e this.headersWidth = this.headersWidthL = this.headersWidthR = 0; const includeScrollbar = !this._options.autoHeight; - let i = 0; - const ii = this.columns.length; - for (i = 0; i < ii; i++) { + for (let i = 0, ii = this.columns.length; i < ii; i++) { if (!this.columns[i] || this.columns[i].hidden) { continue; } @@ -1273,7 +1271,12 @@ export class SlickGrid = Column, O e } if (includeScrollbar) { - if (this._options.frozenColumn! > -1 && i > this._options.frozenColumn!) { + // attribute the scrollbar width to the scrollable band: R when columns are + // frozen, else the single L band. (This previously re-tested the loop variable + // AFTER the loop — i === columns.length, an out-of-range probe — which only + // happened to be equivalent because setFrozenOptions clamps frozenColumn to + // be < columns.length; hasFrozenColumns() states the intent directly.) + if (this.hasFrozenColumns()) { this.headersWidthR += this.scrollbarDimensions?.width || 0; } else { this.headersWidthL += this.scrollbarDimensions?.width || 0; From 116fc3bdad68ebc62ba7e0a6783d82b3e39f4068 Mon Sep 17 00:00:00 2001 From: ghiscoding Date: Mon, 3 Aug 2026 12:42:29 -0400 Subject: [PATCH 2/2] docs: refactor comments on scrollbar width handling --- packages/common/src/core/slickGrid.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/common/src/core/slickGrid.ts b/packages/common/src/core/slickGrid.ts index ae4cd558e..016504e22 100755 --- a/packages/common/src/core/slickGrid.ts +++ b/packages/common/src/core/slickGrid.ts @@ -1271,11 +1271,8 @@ export class SlickGrid = Column, O e } if (includeScrollbar) { - // attribute the scrollbar width to the scrollable band: R when columns are - // frozen, else the single L band. (This previously re-tested the loop variable - // AFTER the loop — i === columns.length, an out-of-range probe — which only - // happened to be equivalent because setFrozenOptions clamps frozenColumn to - // be < columns.length; hasFrozenColumns() states the intent directly.) + // attribute the scrollbar width to the active scrollable band: the right band + // when frozen columns are enabled, otherwise the left band. if (this.hasFrozenColumns()) { this.headersWidthR += this.scrollbarDimensions?.width || 0; } else {