Skip to content

fix(inspector): discover context menus and submenus in element searches - #25

Open
gaoshang212 wants to merge 1 commit into
faze79:mainfrom
gaoshang212:fix/popup-element-search
Open

gaoshang212 wants to merge 1 commit into
faze79:mainfrom
gaoshang212:fix/popup-element-search

Conversation

@gaoshang212

Copy link
Copy Markdown

Summary

Element searches can now discover open context menus and expanded submenus that live outside application window trees.

 search without root_handle
-  search each application window separately
+  collect windows and presentation roots on the Inspector UI thread
+  deduplicate overlapping subtrees before applying the result limit

Explicit root_handle searches retain their subtree scope. Add regression coverage and document the behavior.

Evidence

  • Before (code inspection): GetAllSearchRoots only enumerated Application.Windows, excluding independent context-menu presentation roots. Each window search accumulated results separately.
  • After: All 13 selected integration tests passed, including popup and submenu discovery, closed-menu visibility, cross-root deduplication, result limits, explicit root scope, and dispatcher isolation.
dotnet test tests/WpfVisualTreeMcp.IntegrationTests/WpfVisualTreeMcp.IntegrationTests.csproj --filter 'FullyQualifiedName~PopupSearchTests|FullyQualifiedName~HeaderSearchTests|FullyQualifiedName~AutomationIdTests' --no-restore --verbosity minimal

The test build also compiled the Inspector for net472, net48, and net8.0-windows; runtime tests ran on .NET 8. git diff --check passed.

Merge Danger

Door: two-way

Revert the commit to restore the previous search behavior; no data migration or public IPC contract changes.

Blast Radius: Inspector

Unscoped consumers of shared search roots, including element lookup, waits, diagnostics, and workflow selectors, can now see independent presentation roots on the Inspector UI thread. Explicitly scoped searches remain limited to their subtree.

1. Include presentation roots on the Inspector UI thread so searches
   can discover open context menus and expanded submenus.
2. Deduplicate overlapping subtrees before applying result limits
   while preserving explicit root scope.
3. Add popup search regression tests and document the search behavior.
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