HomeiOS DevelopmentKeyboard toolbar breaks backside protected space after background on iOS 26

Keyboard toolbar breaks backside protected space after background on iOS 26


Listed here are the steps to breed the problem:

  • iOS 26+ required

  • create any enter that triggers opening keyboard

  • add toolbar to keyboard (with any buttons)

  • open keyboard (e.g. by focusing enter)

  • shut keyboard

  • background app (warnings are printed on this step)

  • get again to foreground

  • see that backside protected space is damaged (you’ll be able to add any view that’s certain to protected space)

Eradicating toolbar fixes the problem, btw.

Keyboard toolbar breaks backside protected space after background on iOS 26

The next warnings are printed:

-[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:]  carry out enter operation requires a legitimate sessionID. inputModality = Keyboard, inputOperation = dismissAutoFillPanel, customInfoType = UIUserInteractionRemoteInputOperations

-[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:]  carry out enter operation requires a legitimate sessionID. inputModality = Keyboard, inputOperation = dismissAutoFillPanel, customInfoType = UIUserInteractionRemoteInputOperations

Snapshotting a view (0x15b0a4800, UIKeyboardImpl) that’s not in a visual window requires afterScreenUpdates:YES.

Here’s a take a look at venture for demonstrating the problem:

import SwiftUI

struct ContentView: View {
    @State var choice: Int = 0
    @State var presentingModal = false

    var physique: some View {
        NavigationStack {
            VStack(spacing: 0) {
                TabView(choice: $choice) {
                    Group {
                        Button("Current") { self.presentingModal = true }
                            .tag(0)
                        Textual content("Second").tag(1)
                    }
                    .toolbar(.hidden, for: .tabBar)
                }

                HStack(spacing: 0) {
                    ForEach(0...1, id: .self) { tab in
                        Picture(systemName: "cloud.heavyrain.fill")
                        .padding(.vertical, 16)
                        .body(maxWidth: .infinity)
                        .contentShape(Rectangle())
                        .onTapGesture {
                            choice = tab
                        }
                    }
                }
                .padding(.horizontal, 16)
                .background(Colour.secondary)
            }
            .ignoresSafeArea(.keyboard)
            .navigationTitle("Title")
            .navigationBarTitleDisplayMode(.inline)
        }
        .sheet(isPresented: $presentingModal) {
            PresentedView()
        }
    }
}

struct PresentedView: View {
    @State var textual content = ""
    @FocusState var isInputActive: Bool

    var physique: some View {
        NavigationStack {
            VStack {
                TextField("", textual content: $textual content)
                    .targeted($isInputActive)
                    .padding()
                    .background(.secondary)

                Spacer()
            }
            .padding(.prime, 40)
            .padding(.horizontal, 20)
            .toolbar {
                ToolbarItemGroup(placement: .keyboard) {
                    Button("Shut") {
                        isInputActive = false
                    }
                }
            }
        }
    }
}

#Preview {
    ContentView()
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments