reports icon indicating copy to clipboard operation
reports copied to clipboard

FB20925696: initialFirstResponder broken with modal sessions and DispatchQueue.main

Open lemonmojo opened this issue 1 month ago • 0 comments

Submission Date

2025-11-05

Status

Open

Area

AppKit

Operating System Version

macOS 26.1

Type

Incorrect/Unexpected Behavior

Description

Controls (ie. text fields) added to NSAlerts via NSAlert.accessoryView no longer receive focus when the alert is shown and the text field is configured to automatically receive focus via alert.window.initialFirstResponder.

The issue only reproduces under certain circumstances. There seem to be two conditions that are required for the issue to occur:

  1. The alert must be shown in a modal manner. Either through NSAlert.runModal or a custom modal session via NSApplication.beginModalSession and friends.
  2. The code running the modal session must be invoked through the Main Dispatch Queue (ie. DispatchQueue.main).

When the alert is instead shown through a performSelectorOnMainThread or a regular function call everything's working as expected.

Demo project is available here.

Keywords

No response

Prerequisites

  • [x] The title follows the format FB<number>: <title>
  • [x] I will keep this issue updated with Apple's responses

lemonmojo avatar Nov 05 '25 10:11 lemonmojo