You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Skia] VisualTreeHelper.FindElementsInHostCoordinates returns only ancestors, never the element at the point #24309
VisualTreeHelper.FindElementsInHostCoordinates does not return the element that is actually at the given point. Called at the exact centre of a Button, it returns only ancestors — the Frame and two ContentPresenters — and never the Button itself.
The button at that point is fully interactive: it is enabled, visible, hit-test visible, correctly positioned, and raises PointerEntered, Click and Tapped when clicked at the same coordinates that the API reports nothing for.
Expected
The returned enumeration should contain the Button (and its template parts), innermost-first, as on WinUI.
Actual
Eight at (174.67,356) size 168.67x59.33 centre (259,385.67) enabled=True
hit[0] = Frame
hit[1] = ContentPresenter
hit[2] = ContentPresenter
The Button is absent. Meanwhile, clicking that same centre point produces:
[EVT] PointerEntered
[EVT] Click
[EVT] Tapped
So real hit-testing works; it is this API that disagrees with it.
Repro
Walk the visual tree for a Button, compute its centre in root coordinates, and ask which elements are there:
The button here is a Button subclass inside a Grid in a Page hosted by a Frame, but nothing about it is unusual — no transforms, no clipping, no custom hit-test logic.
Environment
Reproduces identically on both heads, with byte-identical output, so this looks like the shared Skia hit-testing path rather than anything platform-specific:
FindElementsInHostCoordinates is the API you reach for when input is not behaving and you want to know what is on top at a point. Because it silently returns a plausible-looking but wrong answer rather than failing, it actively misleads: while debugging an unrelated input problem it pointed us straight at "the button is not hit-testable", which cost real time before event handlers showed input was fine all along. Automation and diagnostics built on it will be quietly wrong.
Activity