Skip to content

[BUG] StatusBarBehaviour doesn't work for modal pages in .net MAUI 10 #3083

@trampster

Description

@trampster

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

When using StatusBarBehavior to change the colors of the status bar on a Modal, it doesn't not apply to the modal but instead to the page behind.

This happens if you do it in the xaml, or if you do it in code, setting ApplyOn also doesn't help.

This is the starting state of the page behind:

Image

This is the modal which should have orange background and dark text:

Image

This is the page behind after closing the modal (which now has the colors that should have been on the modal):

Image

Expected Behavior

When the model page is shown it should apply the status bar colors set.

Steps To Reproduce

  1. create a new maui project
  2. add a page with Shell.PresentationMode="Modal"
  3. add the community toolkit nuget package
  4. add the following to the modal ContentPage
<ContentPage.Behaviors>
        <toolkit:StatusBarBehavior 
            StatusBarColor="Orange" 
            StatusBarStyle="DarkContent" />
</ContentPage.Behaviors>
  1. register the page as a root Routing.RegisterRoute("modalpage", typeof(ModalPage));
  2. navigate to the page await Shell.Current.GoToAsync("modalpage");
    -> notice that the status bar colors are not applied to the modal page, but instead are applied to the page behind.

Link to public reproduction project repository

https://github.com/trampster/maui-modal-page-statusbar-bug

Environment

- .NET MAUI CommunityToolkit: 14.0.0
- OS: Android 16
- .NET MAUI: 10.0.30

Anything else?

No response

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