-
Notifications
You must be signed in to change notification settings - Fork 1
Bug #94: Keyboard can't dismiss in chat #21
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug #94: Keyboard cannot be dismissed while chatting
Severity: Low
Repro
- Open any book → AI panel → Chat tab
- Tap the text input field → keyboard appears
- Try to dismiss the keyboard by:
- Scrolling the message list
- Tapping outside the input field
- Swiping down on the keyboard
Expected
Keyboard dismisses on scroll or tap outside, matching standard iOS chat app behavior.
Actual
Keyboard stays up. The only way to dismiss is to close the entire AI panel sheet.
Root Cause
AIChatView.swift uses a basic TextField("Type a message…", text: $inputText, axis: .vertical) with minimal modifiers:
- No
.scrollDismissesKeyboard(.interactively)on the ScrollView/List - No
@FocusStatebinding to programmatically dismiss - No keyboard toolbar with "Done" button
- The
.onSubmit { sendCurrentMessage() }only sends the message, doesn't dismiss keyboard
The AI panel is presented as a .sheet with .presentationDetents([.medium, .large]). In .medium detent, keyboard can cover most of the visible content.
Proper Fix
Add standard iOS keyboard dismissal patterns:
// On the ScrollView containing messages:
.scrollDismissesKeyboard(.interactively)
// Or add FocusState:
@FocusState private var isInputFocused: Bool
TextField(...)
.focused($isInputFocused)
// Dismiss on tap outside:
.onTapGesture { isInputFocused = false }
// Optional: keyboard toolbar
.toolbar {
ToolbarItemGroup(placement: .keyboard) {
Spacer()
Button("Done") { isInputFocused = false }
}
}Files
vreader/Views/AI/AIChatView.swift— TextField at line 162, missing dismiss modifiersvreader/Views/Reader/AIReaderPanel.swift— sheet container with NavigationStack wrapper
Refs #6
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working