-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fixed the crash on iOS when setting HeightRequest on WebView inside a ScrollView with IsVisible set to false #29022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 26795, "Specifying HeightRequest in Webview when wrapped by ScrollView set invisible causes crash in iOS", PlatformAffected.iOS)] | ||
| public class Issue26795 : ContentPage | ||
| { | ||
| public Issue26795() | ||
| { | ||
| var layout = new VerticalStackLayout(); | ||
|
|
||
| var webView = new WebView | ||
| { | ||
| Source = "https://en.m.wikipedia.org/wiki", | ||
| HeightRequest = 1000, | ||
| }; | ||
|
|
||
| var label = new Label | ||
| { | ||
| Text = "Test passes if no crash occurs", | ||
| AutomationId = "Label" | ||
| }; | ||
|
|
||
| var scrollView = new ScrollView | ||
| { | ||
| IsVisible = false, | ||
| Content = webView | ||
| }; | ||
|
Comment on lines
+22
to
+26
|
||
| layout.Children.Add(label); | ||
| layout.Children.Add(scrollView); | ||
| Content = layout; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
| public class Issue26795 : _IssuesUITest | ||
| { | ||
| public Issue26795(TestDevice device) : base(device) { } | ||
|
|
||
| public override string Issue => "Specifying HeightRequest in Webview when wrapped by ScrollView set invisible causes crash in iOS"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.WebView)] | ||
| public void WebViewShouldNotCrashWithHeightRequest() | ||
| { | ||
| App.WaitForElement("Label"); | ||
| } | ||
|
Comment on lines
+14
to
+17
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding an
AutomationIdto the WebView to enable more comprehensive UI testing of the layout behavior:This would allow the test to verify that the WebView is properly sized and positioned, not just that the app doesn't crash.