Skip to content

Focus is refused on a just-restored window while another window of the same app is key #23

Closed

Description

@iamnbutler

Bug: an agent can't focus a TextEdit window it has just restored while another TextEdit window is key. desktop_focus was refused with "Timeout while waiting for condition", so the agent couldn't type into its document.

Status: #61 may have fixed this. Focus now also trusts AXFocusedApplication, and replaces the bare timeout with activationNotObserved, which names the app. Nobody has rerun the scenario since.

To do:

  1. Rerun the scenario. Open TextEdit with two windows. Minimize the agent's window, so the other one becomes key. Then call desktop_restore and desktop_focus on the agent's window.
  2. If focus completes, also check that a desktop_click in that window makes it key, then close this issue.
  3. If focus is refused with activationNotObserved, add an AXFrontmost fallback to focus, like the one desktop_activate has.

Original report: githubnext/ace#427 R2, on Ace Canary 0.0.46.52.

Activity

  1. iamnbutler commented on Oct 17, 2026

    @iamnbutler
    Author
  2. changed the title [-]Focus times out on a restored window while another window of the same app is key[/-] [+]Focus is refused on a just-restored window while another window of the same app is key[/+] on Oct 17, 2026
  3. iamnbutler commented on Oct 20, 2026

    @iamnbutler
    ContributorAuthor

    Live check on 0.15.0 (TextEdit, two windows; agent.txt minimized so other.txt was key):

    • desktop_restore on agent.txt: completed. agent.txt came back as the key window, and TextEdit was active.
    • desktop_focus on agent.txt: completed (foreground, confirmed change), with no activationNotObserved. So the AXFrontmost fallback isn't needed.
    • Step 6: a background desktop_click on the text area of the non-key window returned unknown ("did not report AXFocused=true") and didn't make that window key. That's by design: background input never changes the key window, and desktop_focus is the tool for that. Once focus works, the original scenario no longer needs a click to make the window key.

    Closing as fixed by #61.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    live-check-onlyCode is done; only live checks listed in #42 remain

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions