Skip to content

[BUG] StatusBarBehavior on iOS 26+: the status bar color cuts off the Liquid Glass of a pressed navigation bar button #3374

Open

Description

@TheCodeTraveler

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

On iOS 26 and later, the status bar color that StatusBarBehavior (or StatusBar.SetColor) sets cuts off the Liquid Glass of a pressed navigation bar button. While you press and hold a button such as the back button, its glass circle grows above the navigation bar into the status bar area. That part is hidden, so the circle is cut flat along the bottom of the status bar.

It happens only after a status bar color has been set. Before iOS 26, nothing in the navigation bar drew above the bar, so it was not visible.

The cause is in the toolkit. On iOS, the toolkit draws the status bar color with a UIView that it adds as the topmost subview of the window, sized to the status bar frame. On main this is window.AddSubview(statusBar) in SetBarSize and PlatformSetColor, StatusBar.ios.cs. Core Animation draws that view after the root view controller's view, which includes every navigation bar, so anything a bar draws above its own bounds ends up behind the colored view.

Expected Behavior

The pressed button's glass circle is drawn whole, above the status bar color, as it is in an app that sets no status bar color. The status bar area still shows the color that StatusBarBehavior sets.

Steps To Reproduce

  1. Run CommunityToolkit.Maui.Sample on an iOS 26 or iOS 27 simulator, for example an iPhone 17.
  2. Open Behaviors > StatusBarBehavior. The page sets a status bar color.
  3. Press and hold the back button in the navigation bar.
  4. The glass circle of the back button is cut flat at the bottom of the status bar.

For comparison, a fresh launch that never opens a page with a StatusBarBehavior (for example Converters > CompareConverter) shows the circle whole.

Link to public reproduction project repository

https://github.com/CommunityToolkit/Maui/tree/main/samples/CommunityToolkit.Maui.Sample

Environment

- .NET MAUI CommunityToolkit: main (383e96c1) and PR #3344 (db7039a3)
- OS: iOS 26.5 and iOS 27.2 simulators (iPhone 17), macOS 27.2 host
- .NET MAUI: 10.0.90

Anything else?

Research. We recorded the pressed back button on simulators and compared the frames where the circle is largest:

Run Toolkit status bar view Glass circle
PR #3344, iOS 27.2, fresh launch (no StatusBarBehavior page opened) absent round
PR #3344, iOS 27.2, with window.AddSubview removed in a local build absent round
PR #3344, iOS 27.2, after opening a page that sets a color present cut flat at the status bar line (62 pt)
main, iOS 26.5, after opening a page that sets a color present cut flat at the status bar line (62 pt)

.NET MAUI adds no view over the status bar, and it does not clip the navigation bar. MAUI 10.0.90 gives Shell and NavigationPage bars an opaque appearance (ConfigureWithOpaqueBackground), and a top-attached bar's background extends up under the status bar.

Why a small fix does not work:

  • Moving the view behind the content (InsertSubview(statusBar, 0)): the color would disappear behind every navigation bar, because the bar's opaque background extends under the status bar. Pages without a bar draw their own background there too.
  • Hosting the view just below each navigation bar: the status bar area would show the bar's color, not the status bar color, whenever the two differ.
  • A mask or zPosition: zPosition only orders sibling layers, and the glass is a deep descendant of the root view. A mask can only remove pixels of our view; it cannot draw the glass above it.
  • A UIKit API: UIKit has no API for the status bar background. UIStatusBarManager exposes only the frame, the style and whether it is hidden.

Proposed fix: draw the color inside the content instead of over the whole window. On each layout pass for an app window:

  • In each top-attached navigation bar, a color view sits directly above the bar's background view and below its buttons. That is the only position that is above the bar's background and below the glass.
  • Below the bar, a second color view covers pages that hide the navigation bar.
  • Over content without a navigation bar, a color view covers the top of it: the Shell flyout, a FlyoutPage flyout, TabbedPage children and plain modal pages.
  • Where the content structure isn't recognized, the toolkit falls back to today's window view, so the color still shows (with the glass cut as today).
  • The views are re-placed when navigation, modal pages or rotation change the hierarchy.

The bar's background view is private to UIKit. It can be found without class names, as the bar subview whose frame starts above the bar's bounds and spans its width, but that must be checked on iOS 18, 26 and 27 before relying on it.

This changes some looks slightly. For example, the status bar color would dim along with the content under an open flyout or popup. It needs device tests on iOS 18.6, 26.x and 27.2.

Workaround until then: on iOS, leave StatusBarColor transparent on pages that have a navigation bar, for example StatusBarColor="{OnPlatform iOS=Transparent, Default=...}". The navigation bar's own background then fills the status bar area, and the glass is not cut. The next push to PR #3344 documents this limitation and the workaround, and its Sample uses the workaround on the Behaviors gallery page on iOS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions