Since iOS 26, when using toolbar items with .keyboard placement, the view inside the hierarchy which is pushed, does not directly stick to the toolbar anymore when a text field is focused, creating a gap, or moving the view below the toolbar. Focusing another field pushes the layout below the toolbar.
Minimal example to reproduce the issue.
import SwiftUI
import Foundation
@main
struct testfocusApp: App {
@State var showSheet = false
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
struct ContentView: View {
enum Field: Hashable {
case body
case title
}
@State var titleText = ""
@State var bodyText = ""
@FocusState private var focusedField: Field?
var body: some View {
NavigationView {
VStack(spacing: 0) {
ScrollView {
VStack(spacing: 16) {
TextField("", text: $titleText)
.onSubmit {
focusedField = .body
}
.background(Color.red)
.focused($focusedField, equals: .title)
VStack(spacing: 0) {
VStack {
Text(bodyText)
.padding(.vertical, 9)
.padding(.horizontal, 5)
.hidden()
TextEditor(
text: $bodyText
)
.focused($focusedField, equals: .body)
}
}
}
.padding(20)
}
Spacer()
VStack(spacing: 16) {
Text("message")
Button {
} label: {
Text("Save")
.frame(maxWidth: .infinity)
}
}
.border(Color.red)
.background(Color.green)
}
.background(Color.yellow)
.border(Color.purple)
.toolbar {
ToolbarItem(placement: .keyboard) {
Button("Done") {
}
.border(Color.purple)
}
}
}
}
}