Repository navigation
Keep a hidden container from drawing its children or passing them input [patch] - #251
Open
matt-edmondson wants to merge 1 commit into
Open
matt-edmondson wants to merge 1 commit into
matt-edmondson wants to merge 1 commit into
Conversation
…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
|
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.



Summary
UIContainerBase.Rendercalledbase.Render, which returns early for a hidden element, and then rendered every visible child anyway.HandleInputlikewise 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 asUIApplication.RootElement, drew its whole subtree and kept routing input to it whileIsVisible = false.Now both methods return before they reach the children when the container is hidden.
Tests
BorderElementRenderWhenNotVisibleDoesNotCallOnRenderonly 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.HiddenStackPanelRootDrawsNoDescendantsandHiddenStackPanelRootPassesNoInputToChildren.mainand 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