From 7782270f69d886fdd0702b5de865f1a9842d36d1 Mon Sep 17 00:00:00 2001 From: Cipher Shad0w Date: Tue, 19 Aug 2025 08:54:58 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Ensure=20text=20field=20gains=20foc?= =?UTF-8?q?us=20when=20the=20popover=20is=20shown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Searchable Popover Picker/CustomTextField.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Loop/Utilities/Searchable Popover Picker/CustomTextField.swift b/Loop/Utilities/Searchable Popover Picker/CustomTextField.swift index dc8f5459..30520992 100644 --- a/Loop/Utilities/Searchable Popover Picker/CustomTextField.swift +++ b/Loop/Utilities/Searchable Popover Picker/CustomTextField.swift @@ -36,6 +36,13 @@ struct CustomTextField: NSViewRepresentable { func updateNSView(_ nsView: NSTextField, context _: Context) { nsView.stringValue = text + + // Focus the text field when the popover is shown + if nsView.window?.firstResponder != nsView { + DispatchQueue.main.async { + nsView.window?.makeFirstResponder(nsView) + } + } } func makeCoordinator() -> Coordinator {