fix: disable macOS focus ring on chat input TextField (#905) (#1045)

Co-authored-by: jack <212554440+jackjackbits@users.noreply.github.com>
This commit is contained in:
chernomortsev evgeny
2026-03-12 08:56:14 -10:00
committed by GitHub
co-authored by jack
parent 187a5c3195
commit 72093f9648
+18
View File
@@ -27,6 +27,22 @@ private struct MessageDisplayItem: Identifiable {
let message: BitchatMessage let message: BitchatMessage
} }
/// On macOS 14+, disables the default system focus ring on TextFields.
/// On earlier macOS versions and on iOS this is a no-op.
private struct FocusEffectDisabledModifier: ViewModifier {
func body(content: Content) -> some View {
#if os(macOS)
if #available(macOS 14.0, *) {
content.focusEffectDisabled()
} else {
content
}
#else
content
#endif
}
}
// MARK: - Main Content View // MARK: - Main Content View
struct ContentView: View { struct ContentView: View {
@@ -643,6 +659,7 @@ struct ContentView: View {
RoundedRectangle(cornerRadius: 14, style: .continuous) RoundedRectangle(cornerRadius: 14, style: .continuous)
.fill(colorScheme == .dark ? Color.black.opacity(0.35) : Color.white.opacity(0.7)) .fill(colorScheme == .dark ? Color.black.opacity(0.35) : Color.white.opacity(0.7))
) )
.modifier(FocusEffectDisabledModifier())
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
.onChange(of: messageText) { newValue in .onChange(of: messageText) { newValue in
autocompleteDebounceTimer?.invalidate() autocompleteDebounceTimer?.invalidate()
@@ -1243,6 +1260,7 @@ struct ContentView: View {
#if os(iOS) #if os(iOS)
.textInputAutocapitalization(.never) .textInputAutocapitalization(.never)
#endif #endif
.modifier(FocusEffectDisabledModifier())
.onChange(of: isNicknameFieldFocused) { isFocused in .onChange(of: isNicknameFieldFocused) { isFocused in
if !isFocused { if !isFocused {
// Only validate when losing focus // Only validate when losing focus