reports
reports copied to clipboard
FB13296535: SafeAreaInset layout is wrong while dismissing keyboard with .scrollDismissesKeyboard(.interactively)
- Date: 2023-10-23
- Resolution: Open
- Area: SwiftUI
- OS: iOS 17.0
- Type: Incorrect/Unexpected Behavior
Description
When using .safeAreaInset(edge: .bottom) on a ScrollView that also has .scrollDismissesKeyboard(.interactively) set, the view in the safeAreaInset will stay wrongly in the middle of the screen while interactively dismissing the keyboard
To replicate the issue. Create a ScrollView with some elements. Add the .scrollDismissesKeyboard(.interactively) modifier and a view in the bottom with .safeAreaInset(edge: .bottom), a TextField would work best as it would allow you to open the keyboard straight from there. Then, open the keyboard, scroll down to dismiss it.
The expected behaviour would be that the view in the .safeAreaInset(edge: .bottom) would scroll down with the keyboard.
The actual behaviour observed is that .safeAreaInset(edge: .bottom) view would stay in place until the keyboard is fully dismissed, then, quickly move to its correct position.
This is happening with Xcode 15.0 and iOS 17.0 both in the simulator and on device. As far as I can tell, the same happened with iOS 16 and 15.
There is a simple 20 lines of code project attached that replicates the issue. There is also a 6 seconds video that shows the problem.
Files
SafeAreaInsetInteractiveDismissKeyboard.zip
https://github.com/feedback-assistant/reports/assets/593079/f8ff9c91-5f5b-4c34-99ef-163c29784b3b
This is the SwiftUI Bug. Try my solution: https://github.com/frogcjn/BottomInputBarSwiftUI