Skip to content

Keep a hidden container from drawing its children or passing them input [patch] - #251

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/hidden-container-children-180
Nov 11, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/hidden-container-children-180

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Summary

UIContainerBase.Render called base.Render, which returns early for a hidden element, and then rendered every visible child anyway. HandleInput likewise offered every key to the visible children. A nested hidden container wasn't affected, because its parent filters out hidden children. But a container rendered directly, such as UIApplication.RootElement, drew its whole subtree and kept routing input to it while IsVisible = false.

Now both methods return before they reach the children when the container is hidden.

Tests

  • BorderElementRenderWhenNotVisibleDoesNotCallOnRender only passed by accident: the border was never sized, so its child drew nothing either way. The test now sizes and arranges the border before hiding it.
  • New HiddenStackPanelRootDrawsNoDescendants and HiddenStackPanelRootPassesNoInputToChildren.
  • All three fail on main and pass with the fix. Full suite: 329/329 pass.

The related measuring issue (#190, a hidden child still takes layout space) is separate and isn't touched here.

Fixes #180


Generated by Claude Code

…ut [patch]

UIContainerBase.Render called base.Render, which returns early for a hidden
element, then rendered every visible child anyway. HandleInput likewise
offered every key to the visible children. A nested hidden container was
unaffected because its parent filters hidden children, but a container
rendered directly, such as UIApplication.RootElement, drew its whole
subtree and kept routing input to it with IsVisible = false.

Both methods now return before reaching the children when the container is
hidden. BorderElementRenderWhenNotVisibleDoesNotCallOnRender only passed
because its border was never sized, so its child drew nothing either way;
it now sizes and arranges the border before hiding it. New tests cover a
hidden StackPanel root through Render and HandleInput.

Fixes #180

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 242e260 into main Nov 11, 2026
15 checks passed
@matt-edmondson
matt-edmondson deleted the fix/hidden-container-children-180 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

2 participants