SwiftUI.List.scrollDismissesKeyboard(.immediately) causes scroll glitch on List

When the scrollDismissesKeyboard(.immediately) is used on a SwiftUI.List, the scroll is very glitchy when keyboard is open both on simulator and on device. Glitch is visible when content height is smaller than screen height.

A sample code to reproduce the issue:

struct ContentView: View {
    @State private var searchText = ""

    var body: some View {
        NavigationStack {
            List {
                ForEach(0..<1) { index in
                    Rectangle()
                        .fill(Color.blue)
                        .frame(height: 100)
                        .cornerRadius(10)
                        .padding(.vertical, 5)
                        .padding(.horizontal)
                }
            }
            .searchable(text: $searchText)
            .scrollDismissesKeyboard(.immediately)
        }
    }
}

Steps to Reproduce:

  1. Run the code above.
  2. Tap on the search bar so the keyboard appears.
  3. Scroll the list down. Glitch should be visible.

Along with the glitch, there are many warnings being thrown when I interact with the search bar:

-[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:]  perform input operation requires a valid sessionID. inputModality = Keyboard, inputOperation = <null selector>, customInfoType = UIEmojiSearchOperations
-[UIApplication getKeyboardDevicePropertiesForSenderID:shouldUpdate:usingSyntheticEvent:], failed to fetch device property for senderID (***) use primary keyboard info instead.

This API seems very unstable. Is this a known issue? If so, are there plans on fixing it?

Answered by DTS Engineer in 794156022

Please see On Log Noise to determine your next steps for these console logs.

Please see On Log Noise to determine your next steps for these console logs.

Thank you for your response. The warnings may be log noise indeed. Since it was happening together with the issue, I wasn't fully comfortable ignoring them. But they could be unrelated. Do you have an insight regarding the scroll glitch?

SwiftUI.List.scrollDismissesKeyboard(.immediately) causes scroll glitch on List
 
 
Q