dotnet / dotnet/maui

[Android] Navigation stops working after replacing Window.Page when Shell uses ShellHandler

Closed
#38,436 1 comment 1 reaction 0 assignees Claimed by @devanathan-vaithiyanathan View on GitHub
area-shell partner/syncfusion s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 14h
Merged PRs (30d)
296

Description

### Description

This is the same navigation scenario reported in #38026, but it is also reproducible when `Shell` uses the handler-based Android implementation (`ShellHandler`) instead of the compatibility `ShellRenderer`.

After replacing `Window.Page` from a `Shell` with a `NavigationPage`, the Android hardware/system back button and the navigation bar back button stop working.

Related issue: #38026

### Steps to Reproduce

1. Run the attached reproduction project on Android 16 / API 36.
2. Configure the application to use the Android `ShellHandler` implementation.
3. Start the application with a `NavigationPage`.
4. Replace `Window.Page` with a `Shell`.
5. Replace `Window.Page` again with a new `NavigationPage`.
6. Push another page onto the new navigation stack.
7. Press the Android system back button or the navigation bar back button.

### Expected Behavior

The current page should be popped from the active `NavigationPage` navigation stack.

### Actual Behavior

The back action is intercepted and the current page is not popped.

### Link to public reproduction project repository

https://github.com/TomSproet/BackButton11

### Version with bug

11.0.0-preview.6

### Is this a regression from previous behavior?

No, this is something new

### Last version that worked well

Unknown/Other

### Affected platforms

Android

### Affected platform versions

_No response_

### Did you find any workaround?

_No response_

### Relevant log output

```shell

```

Contributor guide

Open the contributing guide

Research direction

Start with the public reproduction project linked in the issue and run it on Android 16/API 36 with the ShellHandler implementation enabled. Follow the Window.Page replacement sequence, then inspect the ShellHandler and NavigationPage back-button path to identify why the active navigation stack is not popped. Done means both the system back button and navigation-bar back button pop the current page after the replacements.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.