Skip to content

iOS App Actions Navigation does not navigate to subpages correctly #16568

@edgiardina

Description

@edgiardina

Description

If you have a Tabbar as the primary shell control, and navigate using AppActions (or applinks, for that matter) with a subpage, the tabbar fails to switch to the selected tab.

Steps to Reproduce

  1. Create a new app with a Tabbar as the primary control
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
    x:Class="MauiBug_iOS_AppAction_Navigation_Tabbar.AppShell"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:MauiBug_iOS_AppAction_Navigation_Tabbar"
    Shell.FlyoutBehavior="Disabled">

    <TabBar>
        <ShellContent
        Title="Page1"
        ContentTemplate="{DataTemplate local:MainPage}"
        Route="page1" />
        <ShellContent
        Title="Page2"
        ContentTemplate="{DataTemplate local:MainPage}"
        Route="page2" />
        <ShellContent
        Title="Page3"
        ContentTemplate="{DataTemplate local:MainPage}"
        Route="page3" />
        <ShellContent
        Title="Page4"
        ContentTemplate="{DataTemplate local:MainPage}"
        Route="page4" />
        <ShellContent
        Title="Page5"
        ContentTemplate="{DataTemplate local:MainPage}"
        Route="page5" />
    </TabBar>
</Shell>
  1. Create a subpage route meant to be visited below one of those tabpages
	public AppShell()
	{
		InitializeComponent();

        Routing.RegisterRoute("subpage", typeof(MainPage));
    }
  1. Create an app action to navigate to a path like //page1/subpage
         .ConfigureEssentials(essentials =>
            {
                //TODO: it's unclear whether icons must be in the Resources/Images folder or in the Platforms/{platform} folder
                essentials
                    .AddAppAction("page1", "Page 1") //works and changes selected tab
                    .AddAppAction("page2", "Page 2") //works and changes selected tab
                    .AddAppAction("page3/subpage", "Page3/subpage") //does not change active tab (but puts subpage in a nav stack underneath page3 tab)
                    .OnAppAction(App.HandleAppActions);

                essentials.UseVersionTracking();
            });
            
            
    public static void HandleAppActions(AppAction appAction)
    {
        App.Current.Dispatcher.Dispatch(async () =>
        {
            await Shell.Current.GoToAsync($"//{appAction.Id}");
        });
    }
  1. AppActions which only have a top level route like //page will work. AppActions with a subpage route will not change the current tab. Interestingly, if you manually navigate to the tab, you can see the subpage navigation was added, but the selected and visible tab from the tabbar is not shown.

Link to public reproduction project repository

https://github.com/edgiardina/MauiBug_iOS_AppAction_Navigation_Tabbar

Version with bug

7.0.86

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 16.4 but suspect all versions

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-shellShell Navigation, Routes, Tabs, Flyoutarea-navigationNavigationPageplatform/ioss/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions