Table focus bug in macOS 27

When I click on a table row, the focus cannot be changed from a TextField to the table.

This is a bug in macOS 27 because the focus can be changed from a TextField to the table in macOS 26.

Temp workaround:

  1. Click a different window, such as Finder or Safari
  2. Click the table in my app.
  3. The focus can be changed from a different app to the table in my app.

Note:

  • Table with focus: the table row is highlighted in blue.
  • Table without focus: the table row is highlighted in grey.

I have this problem on macOS27 as well - but I don't have a TextField. It seems the focus is not given to the SwiftUI Table (in a NSHostingController) - or the focus is not resigned from whatever has the focus in the App.

Workaround is to click on some other App and then click on the Table.

Any other suggestions for workarounds ?

Unfortunately, macOS 27 seems to have broken Table focus behaviour at a very high level. You can easily reproduce the problem with the following SwiftUI app:

import SwiftUI

struct SampleRow: Identifiable {
  let id: Int
}

@main
struct TableFocusApp: App {
  private let rows = (1...40).map { SampleRow(id: $0) }
  @State private var selection = Set<Int>()

  var body: some Scene {
    WindowGroup {
      Table(rows, selection: $selection) {
        TableColumn("C1") { Text("R\($0.id)C1") }
        TableColumn("C2") { Text("R\($0.id)C2") }
      }
      .frame(minWidth: 600, minHeight: 400)
    }
  }
}

Version 27.0 (27A266a), macOS 27.0 (26A428), Swift 6, non isolated.

  • Launch the app and click on a table row. The selection is updated, but the table does not become the first responder.
  • Click on other rows and the selection changes, but first responder does not change. (Keyboard navigation does not work either.)
  • Command-Tab to another application and come back - problem still persists.
  • Command-Tab to another application (Finder), "click around" so that focus in Finder changes in some way, then Command-Tab back to the demo app and the first responder status is now correct and keyboard events change selection.

Unfortunately, I don't know of a workaround to address this issue.

Table focus bug in macOS 27
 
 
Q