Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[.Net10][Proposal][Shell] Shell.PopToRootOnTabReselect property #28562

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Mar 22, 2025

Description of Change

This PR introduces a new BindableProperty called PopToRootOnTabReselectProperty in .NET MAUI Shell. This property allows developers to control whether reselecting the currently active tab should automatically pop its navigation stack to the root page.

On iOS, this behavior is already the default, but on Android, tabs retain their navigation stack when reselected. This property provides a way to align Android’s behavior with iOS, ensuring a consistent user experience across platforms.

Motivation

In many tab-based applications, users expect that tapping an already selected tab should reset its navigation stack, bringing them back to the root of that section. Currently, this behavior must be manually implemented with lots of additional workarounds. This property provides a built-in way to achieve this functionality, improving developer experience and reducing boilerplate code.

Demo

Android iOS
Screen.Recording.2025-03-22.at.16.09.44.mov
Screen.Recording.2025-03-22.at.16.14.54.mov

Usage

<Shell
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="Maui.Controls.Sample.SandboxShell"
    Shell.PopToRootOnTabReselect = "True">

Issues Fixed

Fixes #27401
Fixes #15301

@kubaflo kubaflo requested a review from a team as a code owner March 22, 2025 15:15
@kubaflo kubaflo added t/enhancement ☀️ New feature or request area-controls-shell Shell Navigation, Routes, Tabs, Flyout labels Mar 22, 2025
Copy link
Contributor

Hey there @kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@@ -137,6 +137,19 @@ static void OnFlyoutItemIsVisibleChanged(BindableObject bindable, object oldValu
public static readonly BindableProperty TabBarIsVisibleProperty =
BindableProperty.CreateAttached("TabBarIsVisible", typeof(bool), typeof(Shell), true);


#pragma warning disable RS0016
//todo remove this when changing PR from draft to ready
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to remove.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout community ✨ Community Contribution t/enhancement ☀️ New feature or request
Projects
None yet
2 participants