CommunityToolkit / CommunityToolkit/Maui

[BUG] Snackbar with Anchor not displayed on modal page

Open
#2,734 0 comments 1 reaction 0 assignees View on GitHub
bug unverified
Dominant language
C#
Stars
2.7k
Forks
500
Avg merge
2d 14h
Merged PRs (30d)
7

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Did you read the "Reporting a bug" section on Contributing file?

- [x] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug

### Current Behavior

`Snackbars` with an `Anchor` are not displayed on modal pages.
If you create a Snackbar with `Snackbar.Make`(instead of using `DisplaySnackbar` extension method) and don't set the `Anchor` it works.

Add this button to the modal page to see the difference
```
var displaySnacbackWithoutAnchor = new Button()
.CenterHorizontal()
.Text("Display Snackbar without anchor");
displaySnacbackWithoutAnchor.Command = new AsyncRelayCommand(token => Snackbar.Make(
"This Snackbar is not anchored.",
() => { },
"Close",
TimeSpan.FromSeconds(5)).Show(token));
```

![Image](https://github.com/user-attachments/assets/be0f91a5-9cea-4683-813e-f51bb236c35c)

### Expected Behavior

`Snackbars` with `Anchor` should be displayed on modal pages.

### Steps To Reproduce

1. Run the CommunityToolkit.Maui.Samle application
2. Open the Alerts/Snackbar page.
3. Click on "Show Snackbar in Modal Page"
4. Click on "Display Snackbar"

### Link to public reproduction project repository

https://github.com/CommunityToolkit/Maui/tree/main/samples

### Environment

```markdown
- .NET MAUI CommunityToolkit: Main
- OS: Android 15
- .NET MAUI: 9.0.80
```

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.