21.7 C
Canberra
Tuesday, October 21, 2025

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


I’ve a difficulty on iOS 26 with an app constructed with iOS 18. After a navigation stack pop, the keyboard protected space just isn’t being taken into 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.

Word: The difficulty really additionally happens if I take advantage of Xcode 26, set minimal deployment goal to iOS 26 and construct for iOS 26 Simulator. UIDesignRequiresCompatibility has no impact.

Video

iOS 26 concern

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

iOS 18 behaviour

Word that on iOS 18, the keyboard doesn’t stay targeted 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 undertaking (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’ve this:

struct ContentView: View {
  @State non-public var textual content: String = ""
  @FocusState non-public var isFocused: Bool
  @State non-public 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(Shade.black.opacity(isFocused ? 0.75 : 0.25))
          .targeted($isFocused)
        Button("dismiss keyboard") { isFocused = false }
        Spacer()
      }
      .padding(40)
      .safeAreaInset(edge: .backside) {
        Button("Go to display screen 2") { navigationPath.append("2") }
        .font(.title)
        .buttonStyle(.borderedProminent)
      }
      .navigationDestination(for: String.self) { _ in Textual content("Display 2") }
    }
  }
}

Notes

  • UIDesignRequiresCompatibility in Data.plist has no impact.

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

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

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

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles