fix(cua-driver): refuse minimized Windows element actions - #2849
Merged
Conversation
f-trycua
force-pushed
the
fix/iconic-sentinel-input
branch
from
August 4, 2026 19:46
ddee615 to
72c813d
Compare
Element actions against a minimized window were dispatched to the Win32 iconic position and silently did nothing, while the tool reported success. Windows parks a minimized window at (-32000, -32000), so GetWindowRect returns (-32000,-32000)-(-31840,-31972) -- width 160, height 28, both positive. UIA mirrors that same sentinel into the BoundingRectangle of every element inside the window, so the cached element center is a sentinel point and the window rect is a sentinel rect. point_in_window_bounds then compares one against the other. Because both sides are poisoned identically, the sentinel center tests as *inside* the sentinel window rect and the guard passes. The click is posted to coordinates no monitor covers; nothing happens and no error is raised. The guard that exists to catch off-screen centers is structurally unable to catch this case. Refuse it in resolve_onscreen_point_with_scroll, before the containment check, on either signal: the resolved point being in the sentinel region, or IsIconic on the target window. The point test is kept alongside the authoritative IsIconic call because the reports in trycua#2015 include elements carrying sentinel bounds while their window appeared visible on a secondary monitor -- IsIconic alone would not cover that shape. The error names the remedy (bring_to_front, then re-snapshot), matching the wording the capture path already uses for the same condition. The capture and WGC paths have refused iconic windows since trycua#1973/trycua#1974; this brings the input path in line. Scope: this fixes the silent no-op. get_window_state still reports the raw sentinel bounds in elements[].frame -- suppressing or annotating those changes the response shape, so it is left for a follow-up. Refs trycua#2015, trycua#1979, trycua#1981
Replace the fixed negative-coordinate heuristic with live virtual-desktop bounds, fail before every element click route, and expose window_minimized as a structured refusal. Add a real minimized WPF public-driver cell with fixture, focus, z-order, cursor, and leaked-input oracles, plus evidence-validator coverage.
f-trycua
force-pushed
the
fix/iconic-sentinel-input
branch
from
August 4, 2026 20:57
084ce1f to
67240b3
Compare
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.
Fixes the silent-no-op half of #2015.
Failure
A minimized Win32 window can report the well-formed iconic rectangle
(-32000,-32000)-(-31840,-31972). UIA can mirror that geometry into element bounds, so comparing the element center with the window rectangle succeeds even though the point is on no display. The prior path could then report a successful element action with no visible effect.Final scope
window_minimizedrefusal withstatus: refused,effect: refused, and the restore/re-snapshot remedy.Exact-head validation
Validated at
67240b3b4e474e2f37116586464e83ed3685b32e, rebased onto2be7aab3de35bdffa9d8ad767471c0699d36d6e5:CUA_E2E_SOURCE_SHAboth confirm the exact head SHA.windows-wpf-minimized-element-click-refusalagainst a real minimized HWND.cargo test -p cua-driver-testkit --lib: 50 passed.git diff --checkandcargo fmt --all -- --check: passed.The first two commits remain authored by biztex; the maintainer follow-up only aligns refusal recording with the typed action truth.
Refs #2015, #1979, #1981