HomeiOS DevelopmentKeyboard protected space ignored after NavigationStack pop - iOS 18 app on...

Keyboard protected space ignored after NavigationStack pop – iOS 18 app on iOS 26


I’ve a problem on iOS 26 with an app constructed with iOS 18. After a navigation stack pop, the keyboard protected space is just not being taken under consideration which causes UI to be obscured.

This occurs on App Retailer construct – constructed with Xcode 16 for iOS 18 after which put in from the App Retailer on iOS 26.

Observe: The problem really additionally happens if I exploit Xcode 26, set minimal deployment goal to iOS 26 and construct for iOS 26 Simulator. UIDesignRequiresCompatibility has no impact.

Video

iOS 26 situation

Keyboard protected space ignored after NavigationStack pop – iOS 18 app on iOS 26

iOS 18 behaviour

Observe that on iOS 18, the keyboard doesn’t stay centered when navigating again. If I then focus it onAppear, issues work as anticipated, protected space is revered.

Simulator showing the behaviour on iOS 18

Minimal reproducible instance

For a minimal reproducible instance, create a brand new challenge (in Xcode 16), and run it on the Simulator (iOS 26).

(To get the iOS 26 simulators in Xcode 16, I merely put in Xcode 26, and launched and and put in the iOS runtimes, after which again in Xcode 16 I used to be in a position so as to add a iOS 26 Simulator)

In ContentView, we have now this:

struct ContentView: View {
  @State personal var textual content: String = ""
  @FocusState personal var isFocused: Bool
  @State personal var navigationPath = NavigationPath()

  var physique: some View {
    NavigationStack(path: $navigationPath) {
      VStack(spacing: 20) {
        TextField("Textual content", textual content: $textual content)
          .font(.title)
          .padding(10)
          .border(Coloration.black.opacity(isFocused ? 0.75 : 0.25))
          .centered($isFocused)
        Button("dismiss keyboard") { isFocused = false }
        Spacer()
      }
      .padding(40)
      .safeAreaInset(edge: .backside) {
        Button("Go to display 2") { navigationPath.append("2") }
        .font(.title)
        .buttonStyle(.borderedProminent)
      }
      .navigationDestination(for: String.self) { _ in Textual content("Display 2") }
    }
  }
}

Notes

  • UIDesignRequiresCompatibility in Information.plist has no impact.

  • The problem really additionally happens if I exploit Xcode 26, set minimal deployment goal to iOS 26 and construct for iOS 26 Simulator. UIDesignRequiresCompatibility has no impact.

  • Similar situation with Scroll Views / Lists: The identical situation could be seen in one other frequent situation – as an alternative of a ‘backside factor pinned to protected space’, you possibly can have a Record (or a Scroll View with some parts) – after which the problem is that upon returning to the display, the scroll view doesn’t absolutely scroll down (as a result of it is scroll offset doesn’t take protected space under consideration)

  • Present workaround: Proper now to resolve this I manually dismiss the keyboard earlier than navigating to Display 2. If I additionally really desire a ‘concentrate on seem’ behaviour for the preliminary display, this needs to be finished with a delay of round 1s. All of that is actually not perfect.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments