Skip to content

fix(splitter): preserve pane sizes after collapse - 21.2.x - #17555

Merged
kdinev merged 5 commits into
21.2.xfrom
vkombov/fix-17545-21.2.x
Sep 8, 2026
Merged

fix(splitter): preserve pane sizes after collapse - 21.2.x#17555
kdinev merged 5 commits into
21.2.xfrom
vkombov/fix-17545-21.2.x

Conversation

@viktorkombov

Copy link
Copy Markdown
Contributor

Closes #17545

Description

This PR prevents IgxSplitterPane from losing its configured size after being collapsed and expanded.

Previously, collapsing a pane reset its siblings to size="auto", which caused horizontal panes to lose their previous width. The updated behavior:

  • Preserves pane sizes and min/max constraints.
  • Clears only temporary drag sizes.
  • Allows fixed-size siblings to fill the released space while a pane is collapsed.
  • Handles both runtime and initially collapsed panes.

Testing

Added coverage for horizontal and vertical splitters, fixed-size panes, initial collapse, and temporary drag-size cleanup.

Motivation / Context

Type of Change (check all that apply):

  • Bug fix
  • New functionality
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation
  • Demos
  • CI/CD
  • Tests
  • Changelog
  • Skills/Agents

Component(s) / Area(s) Affected:

How Has This Been Tested?

  • Unit tests
  • Manual testing
  • Automated e2e tests

Test Configuration:

  • Angular version:
  • Browser(s):
  • OS:

Screenshots / Recordings

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

@viktorkombov viktorkombov changed the title fix(splitter): preserve pane sizes after collapse fix(splitter): preserve pane sizes after collapse - 21.2.x Aug 31, 2026
@mddragnev mddragnev added ✅ status: verified Applies to PRs that have passed manual verification and removed ❌ status: awaiting-test PRs awaiting manual verification labels Sep 1, 2026
Copilot AI lite review requested due to automatic review settings September 8, 2026 11:30

Copilot AI 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.

🟡 Changes recommended

The new/updated tests use strict layout equality assertions that are likely flaky across environments, and there’s a small but concrete performance improvement available in the updated flex-grow condition.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates the Splitter pane collapse/expand behavior to preserve configured pane sizes and constraints, preventing panes from “forgetting” their previous dimensions after a collapse cycle (addressing #17545).

Changes:

  • Stops resetting pane sizes/constraints during pane initialization when collapsed panes are present.
  • Updates IgxSplitterPane flex behavior so fixed-size siblings can temporarily grow to fill released space while a neighbor is collapsed, while clearing only temporary drag sizes.
  • Adds/updates unit tests covering collapse/expand for horizontal/vertical splitters, fixed-size panes, initial collapse, and drag-size cleanup.
File summaries
File Description
projects/igniteui-angular/splitter/src/splitter/splitter.component.ts Removes init-time size reset when panes are collapsed to preserve configured sizing.
projects/igniteui-angular/splitter/src/splitter/splitter.component.spec.ts Adds new regression tests for preserving sizes/constraints and clearing drag sizes on collapse/expand.
projects/igniteui-angular/splitter/src/splitter/splitter-pane/splitter-pane.component.ts Adjusts flex-grow calculation to allow fixed-size siblings to fill space when adjacent pane is collapsed; refactors owner handling and drag-size reset.
Review details

Suppressed comments (3)

projects/igniteui-angular/splitter/src/splitter/splitter.component.spec.ts:295

  • Similar to the horizontal case, strict equality on offsetHeight can be brittle due to layout rounding and browser differences. Consider using toBeCloseTo(..., 0) for stability, consistent with other resize assertions in this spec.
        expect(pane1.element.offsetHeight).toBe(pane1Height);
        expect(pane2.element.offsetHeight).toBe(pane2Height);

projects/igniteui-angular/splitter/src/splitter/splitter.component.spec.ts:319

  • Strict equality on offsetWidth here may also be flaky (box model, scrollbars, fractional pixels). Using toBeCloseTo (or rounding) would better reflect the intent: sizes should restore approximately to the pre-collapse widths.
        expect(pane1.element.offsetWidth).toBe(pane1Width);
        expect(pane2.element.offsetWidth).toBe(pane2Width);

projects/igniteui-angular/splitter/src/splitter/splitter.component.spec.ts:553

  • This strict array equality on offsetWidth can be sensitive to small layout differences across browsers/CI (e.g. 99/101px due to rounding). Rounding (or toBeCloseTo per-pane) would make the assertion less flaky while still validating the restore behavior.
        expect(panes.map(pane => pane.element.offsetWidth)).toEqual([100, 100, 100]);
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread projects/igniteui-angular/splitter/src/splitter/splitter.component.spec.ts Outdated
Comment on lines 206 to 209
public get flex() {
const size = this.dragSize || this.size;
const grow = this.isPercentageSize && !this.dragSize ? 1 : 0;
const grow = (this.isPercentageSize || this.hasCollapsedSibling) && !this.dragSize ? 1 : 0;
return `${grow} ${grow} ${size}`;
Comment thread projects/igniteui-angular/splitter/src/splitter/splitter.component.spec.ts Outdated
Comment thread projects/igniteui-angular/splitter/src/splitter/splitter.component.spec.ts Outdated
@kdinev
kdinev enabled auto-merge (squash) September 8, 2026 11:48
@kdinev
kdinev merged commit 7f3de83 into 21.2.x Sep 8, 2026
5 checks passed
@kdinev
kdinev deleted the vkombov/fix-17545-21.2.x branch September 8, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

splitter version: 21.2.x ✅ status: verified Applies to PRs that have passed manual verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants