dotnet / dotnet/maui

WebView does not measure and size correctly across platforms (Windows, Android, iOS, macOS)

Open
#36,064 1 comment 1 reaction 0 assignees View on GitHub
area-controls-webview partner/syncfusion platform/android platform/ios platform/macos platform/windows s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

I have created a simple sample application using WebView in .NET MAUI to demonstrate inconsistent sizing behavior across platforms.

The expected behavior is that the WebView should measure its HTML content and report its desired width and height back to the parent layout, allowing the parent to size it appropriately.

Important:
In this scenario, WidthRequest and HeightRequest are not set. The control is expected to size itself automatically based on its content. Without explicitly setting these values, the WebView should still properly calculate and return its required size.

However, this behavior is inconsistent across platforms. The same code produces different layout results on Windows, Android, iOS, and macOS.

Image

https://github.com/user-attachments/assets/1f05c6a6-36f9-4f14-b51f-5c18836098b4

https://github.com/user-attachments/assets/65a0352b-73dd-4c3b-ab92-ba0f932f4e4c

https://github.com/user-attachments/assets/2bf8e937-81f4-48d2-9e9e-857308cf40bf

### Steps to Reproduce

To showcase the issue, I implemented a chat-like layout using WebView that renders static chat data. This setup simulates a real-world scenario where the WebView should dynamically size itself based on its content.

Please refer to the attached sample project for reproduction.
[WebViewSize.zip](https://github.com/user-attachments/files/29211881/WebViewSize.zip)

### Link to public reproduction project repository

_No response_

### Version with bug

10.0.60

### Is this a regression from previous behavior?

Not sure, did not test other versions

### Last version that worked well

Unknown/Other

### Affected platforms

iOS, I was *not* able test on other platforms

### 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 by running the attached WebViewSize.zip sample project and comparing WebView measurement and layout results on Windows, Android, iOS, and macOS. Confirm the expected behavior: without WidthRequest or HeightRequest, the WebView should report its content size consistently so the parent can size it appropriately.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.