-
Couldn't load subscription status.
- Fork 1.9k
[Android] Fix WebView in a grid expands beyond it's cell #32145
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
Draft
devanathan-vaithiyanathan
wants to merge
5
commits into
dotnet:main
Choose a base branch
from
devanathan-vaithiyanathan:fix-32030
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
baf6f9a
fix added
devanathan-vaithiyanathan eda7dde
added a test case
devanathan-vaithiyanathan 3ebdffe
method name changed and spaces removed
devanathan-vaithiyanathan e8726d4
Snapshot added
devanathan-vaithiyanathan 4ec3cf9
Android snap added
devanathan-vaithiyanathan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+9.77 KB
.../TestCases.Android.Tests/snapshots/android/VerifyWebViewStaysWithinGridCell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 32030, "Android - WebView in a grid expands beyond it's cell", PlatformAffected.Android)] | ||
|
|
||
| public class Issue32030 : ContentPage | ||
| { | ||
| WebView webView; | ||
|
|
||
| public Issue32030() | ||
| { | ||
| // Create Grid | ||
| var grid = new Grid | ||
| { | ||
| RowDefinitions = new RowDefinitionCollection | ||
| { | ||
| new RowDefinition { Height = new GridLength(50) }, | ||
| new RowDefinition { Height = GridLength.Star }, | ||
| new RowDefinition { Height = new GridLength(50) } | ||
| } | ||
| }; | ||
|
|
||
| // Create "above webview" Label | ||
| var topLabel = new Label | ||
| { | ||
| Text = "Above webview", | ||
| AutomationId = "TopLabel", | ||
| HorizontalTextAlignment = TextAlignment.Center | ||
| }; | ||
| grid.Add(topLabel); | ||
| Grid.SetRow(topLabel, 0); | ||
|
|
||
| // Create WebView | ||
| webView = new WebView | ||
| { | ||
| BackgroundColor = Colors.BurlyWood | ||
| }; | ||
| webView.Navigated += WebView_Navigated; | ||
| grid.Add(webView); | ||
| Grid.SetRow(webView, 1); | ||
|
|
||
| // Create "below webview" Label | ||
| var bottomLabel = new Label | ||
| { | ||
| Text = "Below webview", | ||
| HorizontalTextAlignment = TextAlignment.Center | ||
| }; | ||
| grid.Add(bottomLabel); | ||
| Grid.SetRow(bottomLabel, 2); | ||
|
|
||
| // Set the grid as the page content | ||
| Content = grid; | ||
| } | ||
|
|
||
| async void WebView_Navigated(object sender, WebNavigatedEventArgs e) | ||
| { | ||
| await DisplayAlert("Navigation Completed", $"WebView navigated to: {e.Url}", "OK"); | ||
| } | ||
| } |
Binary file added
BIN
+10.1 KB
...ls/tests/TestCases.Mac.Tests/snapshots/mac/VerifyWebViewStaysWithinGridCell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions
18
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32030.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 Issue32030 : _IssuesUITest | ||
| { | ||
| public Issue32030(TestDevice device) : base(device) { } | ||
|
|
||
| public override string Issue => "Android - WebView in a grid expands beyond it's cell"; | ||
| [Test] | ||
| [Category(UITestCategories.WebView)] | ||
| public void VerifyWebViewStaysWithinGridCell() | ||
| { | ||
| App.WaitForElement("TopLabel"); | ||
| VerifyScreenshot(); | ||
| } | ||
| } |
Binary file added
BIN
+7.38 KB
...ts/TestCases.WinUI.Tests/snapshots/windows/VerifyWebViewStaysWithinGridCell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.5 KB
...ls/tests/TestCases.iOS.Tests/snapshots/ios/VerifyWebViewStaysWithinGridCell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could expand to more variants?
Examples:
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.
This will be invoked on every Navigation. The impact on performance now is minimal for the current simple string comparison, but take this into account (for example, if think in use URI parsing or more complex stuff).
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.
@jsuarezruiz , When the source is null, we set the default WebView source to about:blank. As a result, the OnPageFinished method always receives about:blank as the parameter. Therefore, handling additional variants such as about:blank# or about:blank/ is not necessary in this case.
