diff options
| author | Mitchell Hashimoto <m@mitchellh.com> | 2025-09-11 14:13:07 -0700 |
|---|---|---|
| committer | Mitchell Hashimoto <m@mitchellh.com> | 2025-09-11 14:14:14 -0700 |
| commit | c9574ed0c79c4fff86d5f37ee0291ff3d635cd33 (patch) | |
| tree | 739e6ed77e41d9c76970c404f833986c29554146 /macos | |
| parent | 3d6207e88c9310da41ef24476589c887f1b64a15 (diff) | |
macOS: grab text field focus of command palette after tick
Fixes #8497
This works on every other supported version of macOS but doesn't work on
macOS tahoe. Putting it on the next event loop tick works at least on
Sequoia and Tahoe so let's just do that.
Diffstat (limited to 'macos')
| -rw-r--r-- | macos/Sources/Features/Command Palette/CommandPalette.swift | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/macos/Sources/Features/Command Palette/CommandPalette.swift b/macos/Sources/Features/Command Palette/CommandPalette.swift index 3e5a3a36f..8d15cbf9a 100644 --- a/macos/Sources/Features/Command Palette/CommandPalette.swift +++ b/macos/Sources/Features/Command Palette/CommandPalette.swift @@ -165,7 +165,12 @@ fileprivate struct CommandPaletteQuery: View { .textFieldStyle(.plain) .focused($isTextFieldFocused) .onAppear { - isTextFieldFocused = true + // We want to grab focus on appearance. We have to do this after a tick + // on macOS Tahoe otherwise this doesn't work. See: + // https://github.com/ghostty-org/ghostty/issues/8497 + DispatchQueue.main.async { + isTextFieldFocused = true + } } .onChange(of: isTextFieldFocused) { focused in if !focused { |
