Skip to content

Add pointer-route tracing and a pointer-click test locator - #30

Merged
zignd merged 1 commit into
mainfrom
feat/ui-pointer-route-trace
Nov 16, 2026
Merged

zignd merged 1 commit into
mainfrom
feat/ui-pointer-route-trace

Conversation

@zignd

@zignd zignd commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

What

Two tools for diagnosing "the click hit the wrong control":

  • UIContext.TracePointerRoutes (or FORMA_UI_EVENTS=1, which also echoes to stderr) records the dispatch chain for each press and release: the hit target, every bubbled stop with its MouseFilter and press ownership, and the ListBox that receives a press row content stopped. TakePointerRouteTrace() drains it. It allocates nothing while off.
  • Locator.ClickPointer() injects move + press + release, the path a user's click takes, instead of running the accessibility action. Click() cannot reproduce a routing bug because it bypasses dispatch.
  • AccessibilityTree.FindControl(id) resolves the live control behind a snapshot node, so template content (a row's buttons) can be targeted by automation id; walking Control.Children never reached it. The accessibility and style-inspection helpers use it.

Docs explain the trace and the rule that row-interaction tests assert both sides: the widget ran and the row did not activate.

Why

ui-press / Locator.Click() run a control's accessibility action directly. A press that travels the pointer path can run both a row button and the row owner's activation; only real pointer dispatch shows that. This makes the trace and the pointer click available to tests and to the live automation host without a debugger.

Verification

  • bash scripts/check-compliance.sh: pass.
  • Icon pipeline verify: pass.
  • Forma.Tests Release, MonoGame and FNA: 1333 passed, 3 skipped each.
  • No behavior change when the trace is off.

A click that reaches the wrong handler used to need a debugger or a bespoke
repro. Two additions make it observable:

- UIContext.TracePointerRoutes (also FORMA_UI_EVENTS=1) records the dispatch
  chain for each press and release: the hit target, every bubbled stop with its
  MouseFilter and press ownership, and the row owner that receives a press the
  row content stopped. TakePointerRouteTrace() drains it; it allocates nothing
  while off.
- Locator.ClickPointer() injects move + press + release, the path a user's click
  takes, instead of running the accessibility action. Click() cannot reproduce
  a routing bug because it bypasses dispatch entirely.

AccessibilityTree.FindControl(id) resolves the live control behind a snapshot
node, so template content (a row's buttons) can be clicked by automation id;
walking Control.Children never reached it. The accessibility and inspect helpers
now use it, and the docs say why a row test asserts both sides: the widget ran
and the row did not activate.
@zignd zignd closed this Nov 16, 2026
@zignd zignd reopened this Nov 16, 2026
@zignd
zignd merged commit f4319df into main Nov 16, 2026
41 of 42 checks passed

This branch was previously deployed

1 inactive deployment
github-pages — f4319df8 Deployed Nov 16, 2026 by zignd via deploy #172
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.

1 participant