Skip to content

Keep approvals and Touch ID prompts focused without bringing the app forward - #156

Merged
sudoHG merged 2 commits into
mainfrom
sudoHG/127-approval-focus
Oct 5, 2026
Merged

sudoHG merged 2 commits into
mainfrom
sudoHG/127-approval-focus

Conversation

@sudoHG

@sudoHG sudoHG commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Refs #127

Problem

Presenting an approval called NSApp.activate(ignoringOtherApps:) so the panel could take keyboard focus. Activation brings every open Ask Key window forward, so whenever the management window was open behind other apps, each approval pulled it to the front together with the prompt. Ask Key is a menu-bar app; the prompt should appear on its own. (Present since v0.1.0, reported during the v0.2.0 acceptance.)

Change

  • The approval panel is a non-activating panel (.nonactivatingPanel, becomesKeyOnlyIfNeeded = false): it becomes key and receives Return and Esc without activating the app. Its level (.modalPanel), space behavior and hidesOnDeactivate = false are unchanged.
  • The explicit NSApp.activate before presenting an approval is removed. Opening the management window from the menu bar still activates the app.
  • AgentApprovalPanelTests asserts the non-activating style and that the panel can become key.

Touch ID prompt focus

The Touch ID prompt is shown by a separate authentication process (--askkey-authenticate) that never activated itself, so the prompt appeared without focus and the sensor was not ready until the user clicked it (reveal plaintext, unlock, approval with authentication). The authentication process now activates itself before evaluatePolicy, and the app yields activation to it when the app is active.

Checks

  • swift build: passed.
  • swift test --filter 'AgentApprovalPanelTests|ApprovalPrompt': 9 passed, 0 failed.
  • swift test --filter ManagementAuthentication: 24 passed, 0 failed.
  • python3 scripts/check_hygiene.py, python3 scripts/check_module_deps.py: passed.
  • Full suite and the approval desktop flows (button clicks, Esc): this PR's CI.

@sudoHG sudoHG changed the title Show approval prompts without bringing the app forward Keep approvals and Touch ID prompts focused without bringing the app forward Oct 5, 2026
@sudoHG
sudoHG merged commit 5261440 into main Oct 5, 2026
2 checks passed
@sudoHG
sudoHG deleted the sudoHG/127-approval-focus branch October 5, 2026 11:43
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