dotnet / dotnet/maui

[Android] WebView Height Continuously Increases on Pixel 5, API 33

Open
#32,422 8 comments 0 reactions 0 assignees View on GitHub
area-controls-webview has-workaround partner/syncfusion platform/android s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

When using a WebView inside a custom Grid control on Android (Pixel 5, API 33), the height of the control continuously increases over time. This behavior is not observed on other platforms like iOS or Windows.

**Note**: The issue is specifically reproduced when the layout structure is Border → Grid → WebView. If the Border is removed and the structure becomes Grid → WebView, the issue no longer occurs. This suggests the Border may be contributing to the layout instability.

### Steps to Reproduce

1. Create a custom view inheriting from Grid.
2. Add a WebView with a fallback HTML source.
3. Embed the WebView inside a Grid, which is wrapped in a Border, and place that inside the root Grid.
4. Run the app on Android (Pixel 5, API 33).
5. Observe the control height increasing continuously.

#### Expected Behavior
The WebView should maintain a consistent height and render the fallback HTML without affecting layout dimensions.

#### Actual Behavior
The control's height keeps growing, leading to layout overflow and rendering issues.

#### Device Information
• **Device**: Pixel 5
• **OS Version**: Android 13 (API 33)
• **.NET MAUI Version**: 9.0.111,9.0.82
• **Platform**: Android

Code Snippet:

```
public class CustomView : Grid
{
public CustomView()
{
var border = new Border() { Stroke = Colors.Red };
var grid = new Grid();
var webview = new WebView();
var fallbackHtml = @"

Loading editor...

";
webview.Source = new HtmlWebViewSource { Html = fallbackHtml };
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Star });
border.Content = grid;
grid.Children.Add(webview);
Grid.SetRow(webview, 0);
this.Children.Add(border);
}
}
```

https://github.com/user-attachments/assets/d64b60bb-8367-46fa-ba6b-02df17a08546

[IssueSample.zip](https://github.com/user-attachments/files/23386920/IssueSample.zip)

### Link to public reproduction project repository

_No response_

### Version with bug

9.0.82 SR8.2

### Is this a regression from previous behavior?

Not sure, did not test other versions

### Last version that worked well

Unknown/Other

### Affected platforms

Android

### Affected platform versions

Android 13

### Did you find any workaround?

_No response_

### Relevant log output

```shell

```

Contributor guide

Open the contributing guide

Research direction

Start with IssueSample.zip and reproduce the layout on Android 13/API 33 using the Pixel 5 setup described. Compare the Border → Grid → WebView structure with the Border-removed version while observing layout measurements; done means the WebView keeps a stable height and renders the fallback HTML without layout overflow.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.