Respect IsCollapsable in proportional cleanup#998
Merged
wieslawsoltes merged 2 commits intomasterfrom Jan 22, 2026
Merged
Conversation
This was referenced Feb 2, 2026
This was referenced Feb 9, 2026
This was referenced Feb 18, 2026
This was referenced Feb 25, 2026
This was referenced Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary: Issue 933 - Preserve Non-Collapsable ProportionalDock
Summary
This change fixes issue #933 where
ProportionalDock.IsCollapsable = falseprevented empty-dock collapsing but did not prevent single-child simplification. The proportional cleanup routine now respectsIsCollapsable, so non-collapsable proportional docks remain in the layout tree even when left with a single child.Problem
FactoryBase.CollapseDockcorrectly checksIsCollapsablefor empty-dock removal. However, when a child dock is collapsed and the parent proportional dock ends up with a single child,CleanupProportionalDockTreeused to simplify the tree unconditionally. This could remove a structuralProportionalDockeven whenIsCollapsable = false.Fix Overview
CleanupProportionalDockTreenow returns early whendock.IsCollapsableisfalse.Implementation Details
Code Change
The guard lives in
FactoryBase.CleanupProportionalDockTree:Regression Test
A new headless test covers the scenario from issue #933 by:
mainArea) withIsCollapsable = falsethat contains a document, a splitter, and a collapsable bottom pane.mainArearemains in the tree with the document as its only child.Test location:
tests/Dock.Avalonia.HeadlessTests/FactorySplitTests.csBehavior Changes
ProportionalDockwithIsCollapsable = falsecould still be simplified away when it had a single child.Usage Guidance
If you want a proportional dock to stay as a persistent layout container, set
IsCollapsable = falseon it:This ensures that both empty-dock collapse and single-child simplification will not remove the dock. For docks that should be simplified when reduced to a single child, keep the default (
IsCollapsable = true).Tests
CollapseDock_DoesNotSimplify_NonCollapsable_ProportionalDockDock.Avalonia.HeadlessTestsFixes #933