Repository navigation
feat(useMouse): opt-in respectClipping to hit children outside their parent - #98
Merged
Merged
Conversation
…parent The mouse hit test stops descending at any node the pointer misses, so a child drawn outside a non-clipping parent (clipping is off by default in the renderer) can't be hovered or clicked with the LG Magic Remote. With `respectClipping: true`, a subtree is cut off only where a node sets `clipping`; the search otherwise keeps descending, recording only nodes the pointer is over. Topmost wins by zIndex, then later sibling, with an index tiebreak since old webOS engines lack a stable sort. Off by default, so the existing single-path search is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 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.
What
Adds an opt-in
respectClippingoption touseMouse:Why
Reported from an LG app: elements drawn outside their parent's bounds (parent with
clipping: false, the renderer default) render fine but can't be hovered or clicked with the Magic Remote. The hit test ingetChildrenByPositiononly descends into a child the pointer is inside, so it treats every node as if it clipped.How
UseMouseOptionsgainsrespectClipping?: boolean.customStatesis now optional, so{ respectClipping: true }works alone; every previously valid shape still type-checks.collectHitPathDFS runs instead of the single-path loop:clippingsetforwardStateslogic downstream is unchangedzIndex, then later sibling (same tie rule as today), with an explicit index tiebreak because old webOS engines don't have a stableArray.prototype.sortalpha: 0andskipFocussubtreesReviewer notes
findElementByActiveElement(click withoutcustomStates) only tests the active element and its ancestors against their own boxes, so it needed no change.<view>with no width/height fills its parent, so size-less wrappers were never part of this bug.Tests
Five new tests in
tests/useMouse.test.tsx(useMouse respectClipping): default still misses an overflowing child; flag on hits it; a clipping parent still blocks; hover + click reach an overflowing child viacustomStates; a higher-z sibling's overflow beats a lower sibling. Full suite: 772 passed,tscand lint clean.🤖 Generated with Claude Code