dotnet / dotnet/maui

Add args to IWindow.SendBackButton so that users have context about where the back button click originated

Open
#3,447 2 comments 2 reactions 0 assignees View on GitHub
area-controls-window legacy-area-controls proposal/open t/enhancement ☀️
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

Currently on Android the Toolbar BackButton and the Hardware BackButton will both look the same at the xplat level. It'd be useful to add some args to the BackButtonPressed methods so that users can act on more information

### Public API Changes

```C#
public interface IWindow
bool SendBackButtonClicked(BackButtonClicked args)
```

```C#
public class BackButtonClickedArgs
{
public BackButtonSource Source {get; set;}
}
```

```c#
public enum BackButtonSource
{
Toolbar, HardWare
}
```

### Intended Use-Case

This allows users to change behavior based on if the user clicked the Toolbar backbutton or the HardwareBackButton

Contributor guide

Open the contributing guide

Research direction

Start by locating the IWindow.SendBackButtonClicked API and the Android Toolbar BackButton and Hardware BackButton handling paths. Trace how each path reaches the cross-platform layer and check the existing BackButtonPressed methods. Done means both sources provide the requested BackButtonClickedArgs with the correct BackButtonSource value and the public API is consistent across platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
mobile-dev
Issue type
Feature
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.