Skip to content

Leave a hidden child out of BorderElement's and the default container measure [patch] - #252

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/hidden-child-measure-190
Nov 11, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/hidden-child-measure-190

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Summary

UIContainerBase's default measure looped over every child, and BorderElement measured Children.First() whether or not it was visible. StackPanel already filtered to visible children. So collapsing a section with IsVisible = false, either inside a BorderElement or inside a custom container that uses the default measure, still reserved the hidden child's rows.

Both measures now consider only visible children. A border whose child is hidden measures as the bare border, still wide enough for its title.

Tests

  • New UIContainerBaseMeasureTests.DefaultMeasurementIgnoresHiddenChildren, covering both the width-independent and the width-dependent measure.
  • New BorderElementRenderTests.HiddenChildIsMeasuredAsAbsent: a bordered section with a hidden two-line child, inside a vertical StackPanel, measures 2×2, and the next element is drawn directly under it.
  • Both fail on main and pass with the fix. Full suite: 329/329 pass.

This change is independent of #251, which handles hidden containers drawing their children (#180). Each PR stands alone on main.

Fixes #190


Generated by Claude Code

… measure [patch]

UIContainerBase's default measure looped over every child, and BorderElement
measured Children.First(), whatever its visibility. StackPanel already
filtered to visible children, so collapsing a section with IsVisible = false
inside a BorderElement, or inside a custom container on the default measure,
still reserved the hidden child's rows.

Both measures now consider only visible children, so a border whose child is
hidden measures as the bare border (still wide enough for its title).

Fixes #190

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW2U95Ey8C2h9t4Ljwn
@sonarqubecloud

sonarqubecloud Bot commented Nov 5, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 80d5efa into main Nov 11, 2026
15 checks passed
@matt-edmondson
matt-edmondson deleted the fix/hidden-child-measure-190 branch November 11, 2026 00:03
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.

A hidden child still takes up layout space: BorderElement and the default container measure count IsVisible = false children

2 participants