Skip to content

fix(cua-driver): honor disabled UIA ancestors - #3263

Open
ethanblake4 wants to merge 1 commit into
trycua:mainfrom
ethanblake4:windows-effective-enabled
Open

fix(cua-driver): honor disabled UIA ancestors#3263
ethanblake4 wants to merge 1 commit into
trycua:mainfrom
ethanblake4:windows-effective-enabled

Conversation

@ethanblake4

@ethanblake4 ethanblake4 commented Aug 19, 2026

Copy link
Copy Markdown

Enabled UIA children of a disabled parent are not actionable (eg a nominally enabled checkbox inside a disabled container cannot be actually clicked), yet Cua reports them as such on Windows. This PR allows the information to propagate from parent to children.
Validation: cargo test -p platform-windows uia::tests --locked; cargo check -p platform-windows --locked; cargo fmt --all -- --check; git diff --check. Known gap: native behavior still depends on each provider reporting the disabled ancestor accurately.

@injaneity injaneity left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the descendants are correctly effectively disabled, meaning that they have no index and are not stored in the action cache - but walk_cached_bounded creates a com reference that isn't dropped and doesn't belong to the cache

please enforce the invariant that element_ptr != 0 if and only if element_index.is_some(). retain a com reference only for actionable nodes, and use element_ptr: 0 for observation-only nodes. this also lets the walker construct uianode once instead of maintaining duplicated actionable and non-actionable literals.

Image

another minor issue worth addressing: _observation_only walks deliberately skip the cache update, which might leave hanging references as previously mentioned

@ethanblake4

Copy link
Copy Markdown
Author

Thanks, fixed

@injaneity injaneity left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for fixing the disabled-ancestor behavior. one ownership issue still blocks this: the walker retains com references, but cleanup only happens on the successful observation-only path. for example, if screenshot processing fails after the tree walk, the function returns before the cleanup call, so every actionable reference from that walk leaks. please make the walk result release its references automatically, with an explicit ownership transfer when the cache adopts them. this also removes the need for manual cleanup at each caller.

@ethanblake4
ethanblake4 force-pushed the windows-effective-enabled branch from e010659 to f1877a2 Compare August 27, 2026 22:44
@ethanblake4
ethanblake4 force-pushed the windows-effective-enabled branch from f1877a2 to 06ab58c Compare August 27, 2026 22:54
@ethanblake4

Copy link
Copy Markdown
Author

Done @injaneity

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.

2 participants