Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updated condition only for iPad
  • Loading branch information
SubhikshaSf4851 committed Mar 27, 2026
commit 97fab15c56cf43a0a3d1afc071878d61ee565083
13 changes: 7 additions & 6 deletions src/Core/src/Handlers/SearchBar/SearchBarHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ protected override MauiSearchBar CreatePlatformView()

_editor = searchBar.GetSearchTextField();

// On iOS/MacCatalyst 26+, UISearchBar defaults InsetsLayoutMarginsFromSafeArea to
// true, which causes an unexpected left margin equal to the safe area inset when
// the search bar is placed inside a Grid in iPad windowed/split-screen mode (#34551).
// Setting this once at creation is sufficient because UIKit respects the value for
// the lifetime of the view and does not reset it internally.
if (OperatingSystem.IsIOSVersionAtLeast(26) || OperatingSystem.IsMacCatalystVersionAtLeast(26))
// On iPadOS 26, in windowed or split-screen mode, the window chrome (traffic lights)
// introduces a left safe area inset. UIKit applies this inset to the search bar's
// layout margins via InsetsLayoutMarginsFromSafeArea. Because MAUI already accounts
// for safe area at the layout level, this results in a double-inset — an unexpected
// extra left margin (#34551). Setting this to false at creation prevents it;
// UIKit does not override it later.
if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad && OperatingSystem.IsIOSVersionAtLeast(26))
{
searchBar.InsetsLayoutMarginsFromSafeArea = false;
}
Expand Down
Loading