Files
yattee/Shared/Search/FocusableSearchTextField.swift
Arkadiusz Fal 8c5c503df2 Fix iPad iOS 18 keyboard dismissal issue in search
Removed auto-focus logic that was causing keyboard show/hide loop
on iPad with docked keyboard. The keyboard was repeatedly dismissing
immediately after appearing due to interaction between keyboard
notifications, focus state changes, and view updates.

Changes:
- Removed focused state and keyboard observer from SearchModel
- Removed iOS textField reference (kept macOS only)
- Removed auto-focus logic from FocusableSearchTextField on iOS
- Cleaned up unused focus-related code

The search field now works reliably when tapped manually on iPad.
Auto-focus still works on macOS where it doesn't cause issues.
2025-11-20 17:49:10 +01:00

20 lines
522 B
Swift

import Repeat
import SwiftUI
import SwiftUIIntrospect
struct FocusableSearchTextField: View {
var body: some View {
SearchTextField()
#if os(macOS)
.introspect(.textField, on: .macOS(.v12, .v13, .v14, .v15)) { textField in
SearchModel.shared.textField = textField
}
.onAppear {
DispatchQueue.main.async {
SearchModel.shared.textField?.becomeFirstResponder()
}
}
#endif
}
}