Skip to content

fix(splitter): fix pane resizing bugs and reach 100% coverage - #17772

Open
ivanvpetrov wants to merge 3 commits into
masterfrom
ipetrov/splitter-refactor
Open

ivanvpetrov wants to merge 3 commits into
masterfrom
ipetrov/splitter-refactor

Conversation

@ivanvpetrov

@ivanvpetrov ivanvpetrov commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes several resizing bugs in IgxSplitterComponent / IgxSplitterPaneComponent, removes dead code and brings the splitter unit test coverage to 100%.

Bug fixes

  • Percentage minSize / maxSize values are now honored while resizing. Previously '40%' was parsed as 40px.
  • Dragging a bar now resizes the panes to the current pointer position. Previously the panes lagged one pointer move behind, because dragMove pageX/pageY hold the previous position (nextPageX/nextPageY are now used).
  • Releasing a dragged bar now always applies the pane sizes and emits resizeEnd, including when the pointer is released at the drag start point. Previously the temporary drag size stayed applied and resizeStart had no matching resizeEnd.
  • A bar dragged across the resize direction no longer moves away from its position. igxDrag's own move is now always cancelled, since the bar follows the resized panes.
  • Ctrl + arrow keys no longer collapse panes when nonCollapsible is set (the expanders were already disabled).
  • Ending a resize after the splitter shrinks no longer sets negative pane sizes. The pair of panes is fitted in the splitter instead.
  • Setting a pane size to null / undefined no longer throws. The pane falls back to 'auto'.

Behavioral change

  • Arrow key resizing now updates the pane size and emits resizeStart, resizing and resizeEnd on each key press, as a pointer drag does. Previously only a temporary px size was applied, resizeEnd was never emitted and % / auto panes stopped adapting to the splitter size.

Refactoring / dead code

  • The keyboard handler switch (duplicated preventDefault, old non-standard up/down/left/right key names, empty default) is replaced with a key → action map.
  • Removed the internal getPaneSiblingsByOrder (replaced by a template array), the dragDir getter and the [dragDirection] binding, which no longer has any effect.
  • Simplified the onMoveEnd size conversion and read the splitter size once per call.
  • Replaced any types in the pane and bar, and the magic numbers in the bar template.

Docs

  • splitter/README.md: fixed the customization notes (pane/bar order and bar nonCollapsible are not public inputs), documented % min/max sizes, keyboard resize events and the nullish size fallback.
  • CHANGELOG.md: added Behavioral Changes and Bug Fixes entries.

Motivation / Context

Splitter analysis and coverage pass. The component had uncovered drag handlers (onDragMove, onDragEnd) and several resize bugs that showed up once the drag flow was tested with real pointer events.

The drag handling is independent of #17744 (igxDrag cancel). That PR's cancel features are opt-in and not used by the splitter.

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:

Splitter (IgxSplitterComponent, IgxSplitterPaneComponent, internal IgxSplitBarComponent)

How Has This Been Tested?

  • Unit tests

  • Manual testing

  • Automated e2e tests

  • Added specs for pointer drag in both orientations (via real pointer events), dragging across the resize direction, releasing at the drag start point, keyboard resize commits and events, ignored keys, nonCollapsible with Ctrl + arrows, % min/max sizes, nullish size and fitting the panes after the splitter shrinks. All new specs failed before the fix.

  • Updated the existing keyboard specs to assert the rendered sizes instead of the temporary drag size, and replaced a transform spec that only emitted bar outputs directly with real pointer drag specs.

  • Splitter suite: 37/37 passing, stable over repeated runs. Coverage of splitter.component.ts and splitter-pane.component.ts: 100% statements / branches / functions / lines (previously 91% / 88.5% / 94.3% / 91% for splitter.component.ts).

  • npm run lint:lib passes. The splitter entry point compiles with strict templates.

Test Configuration:

  • Angular version: 22.2.0
  • Browser(s): Chrome Headless 155
  • OS: Windows 11

Screenshots / Recordings

N/A

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

- honor % minSize/maxSize and current pointer position when dragging
- always commit sizes and emit resizeEnd on drag end and keyboard resize
- keep the bar in place when dragged across the resize direction
- respect nonCollapsible for Ctrl + arrow keys
- fall back to 'auto' for nullish pane size
- remove dead keyboard and sibling lookup code
@ivanvpetrov ivanvpetrov changed the title fix(splitter): fix pane resizing bugs and reach coverage fix(splitter): fix pane resizing bugs and reach 100% coverage Oct 13, 2026
@georgianastasov
georgianastasov requested a balanced review from Copilot October 14, 2026 13:42

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

Constraint edge cases can still produce negative sizes or ignore a valid zero maximum.

3 open findings
What changed in this PR

Fixes splitter resizing behavior across pointer, keyboard, constraints, and nullish pane sizes.

Changes:

  • Corrects drag and keyboard resizing behavior and events.
  • Adds percentage constraints and pane-fitting logic.
  • Expands tests and updates documentation.
File Description
splitter.component.ts Refactors resize calculations and interactions.
splitter.component.spec.ts Adds resizing regression tests.
splitter.component.html Simplifies sibling lookup.
splitter-pane.component.ts Adds typing and nullish-size fallback.
splitter-bar.component.html Uses enum values and removes drag direction.
splitter/​README.md Documents updated behavior.
CHANGELOG.md Records fixes and behavioral changes.

🧠 Review effort: Balanced


💡 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.ts Outdated
Comment thread projects/igniteui-angular/splitter/src/splitter/splitter.component.spec.ts Outdated
- cap the protected pane at the splitter size when fitting panes
- treat a zero maxSize as a valid constraint
- make the drag spec helper generic

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.

🔵 Needs a closer look

Browser-dependent pointer, layout-constraint, and keyboard accessibility behavior warrants final human validation.

0 open findings

3 resolved since last review

🧠 Review effort: Balanced

@ivanvpetrov
ivanvpetrov marked this pull request as ready for review October 14, 2026 15:24

This branch has not been deployed

No deployments
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.

2 participants