CommunityToolkit / CommunityToolkit/Maui
[BUG] Snackbar + UseMaterial3 overrides BackgroundColor [Android/Material3]
- 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
Background is light-purple-ish-gray and not DarkOrange
### Expected Behavior
DarkOrange background
### Steps To Reproduce
Create a new project
```powershell
dotnet new maui -n SnackbarProblem
```
Replace the OnCounterClicked with the following
```csharp
private void OnCounterClicked(object? sender, EventArgs e)
{
Snackbar.Make(
"Hello, World!",
null,
"OK",
TimeSpan.FromSeconds(7),
new SnackbarOptions
{
BackgroundColor = Color.FromRgb(255, 140, 0), // DarkOrange
TextColor = Colors.White,
ActionButtonTextColor = Colors.White,
CornerRadius = 8,
Font = Microsoft.Maui.Font.SystemFontOfSize(14)
}).Show();
}
```
Run and click the button
Background is DarkOrange as expected. So far so good.
Now enable Material3:
```xml
true
```
And run and click the button
Background is light-purple-ish-gray and not DarkOrange anymore which is the problem.
### Link to public reproduction project repository
na
### Environment
```markdown
OS: Android / Material3
```
### Anything else?
_No response_
Contributor guide
Research direction
Start by creating the reported .NET MAUI project, reproducing the Snackbar with the supplied SnackbarOptions, and then enabling true. Compare the Android behavior with and without Material 3; done means the configured DarkOrange BackgroundColor remains visible when Material 3 is enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, csharp
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100