Skip to content

Fix WebView SwipeView gestures on Android - #36499

Merged
rmarinho merged 2 commits into
mainfrom
fix/forward-flow-36231-webview-swipeview
Jul 10, 2026
Merged

Fix WebView SwipeView gestures on Android#36499
rmarinho merged 2 commits into
mainfrom
fix/forward-flow-36231-webview-swipeview

Conversation

@kubaflo

@kubaflo kubaflo commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Fixes #36154.

Forward-ports the final implementation and regression coverage from #36231 to main, preserving the newer WebView lifecycle handling already present on main.

The Android SwipeView now yields to a nested WebView while it can scroll in the gesture direction, and handles the gesture at the WebView edge.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: cf5a6299-1e58-4157-b7fd-b85efaa14755
Copilot AI review requested due to automatic review settings July 10, 2026 11:06
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool July 10, 2026 11:07 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36499

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36499"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an Android regression where SwipeView can no longer reliably detect swipe gestures when the user swipes directly on a nested WebView. It updates the Android platform implementations to let the WebView consume gestures while it can scroll in the gesture direction, and lets SwipeView handle the gesture when the WebView is at its scroll edge, with UI-test coverage added for the regression scenario.

Changes:

  • Android MauiWebView avoids calling RequestDisallowInterceptTouchEvent(true) when hosted within a SwipeView, preventing FLAG_DISALLOW_INTERCEPT from blocking SwipeView gesture detection.
  • Android MauiSwipeView adds a WebView-specific intercept decision using CanScrollHorizontally/Vertically and SwipeDirection.
  • Adds a HostApp repro page and a Shared UI test for issue #36154.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/Core/src/Platform/Android/MauiWebView.cs Caches whether the WebView is inside a MauiSwipeView and conditionally suppresses RequestDisallowInterceptTouchEvent(true) to allow SwipeView swipes.
src/Core/src/Platform/Android/MauiSwipeView.cs Adds direction-aware WebView edge detection (ShouldInterceptWebViewTouch) to decide when SwipeView should intercept.
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue36154.cs Adds a UI regression test that swipes on the SwipeView/WebView area and asserts the RightItems command was invoked.
src/Controls/tests/TestCases.HostApp/Issues/Issue36154.cs Adds a HostApp issue page with a WebView inside SwipeView to reproduce/validate the behavior.

Comment thread src/Core/src/Platform/Android/MauiSwipeView.cs
Comment thread src/Controls/tests/TestCases.HostApp/Issues/Issue36154.cs
@kubaflo
kubaflo marked this pull request as draft July 10, 2026 11:46
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: cf5a6299-1e58-4157-b7fd-b85efaa14755
@kubaflo
kubaflo marked this pull request as ready for review July 10, 2026 11:46
Copilot AI review requested due to automatic review settings July 10, 2026 11:46
@rmarinho
rmarinho merged commit c03ff77 into main Jul 10, 2026
4 of 13 checks passed
@rmarinho
rmarinho deleted the fix/forward-flow-36231-webview-swipeview branch July 10, 2026 11:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment on lines +39 to +45
<p>Scroll down to verify WebView vertical scrolling works inside SwipeView.</p>
<p>Then swipe left/right to reveal swipe items.</p>
<p>At the top edge, swipe down to reveal TopItems.</p>
<p>At the bottom edge, swipe up to reveal BottomItems.</p>
""" + string.Concat(Enumerable.Range(1, 40).Select(i =>
$"<p>Line {i}: Lorem ipsum dolor sit amet consectetur adipiscing elit.</p>"))
+ "</body></html>"
Comment on lines +30 to +33
// Swipe left (finger moves left) → reveals RightItems
App.DragCoordinates(centerX, centerY, centerX - 200, centerY);

Assert.That(App.WaitForElement("ResultLabel").GetText(), Is.EqualTo("RIGHT invoked!"));
Comment on lines +174 to +183
// Determines whether the SwipeView should intercept touch events when the content is a WebView, based on the WebView's scroll position and the swipe direction.
static bool ShouldInterceptWebViewTouch(AWebView webView, SwipeDirection swipeDirection) =>
swipeDirection switch
{
SwipeDirection.Right => !webView.CanScrollHorizontally(-1), // at left edge
SwipeDirection.Left => !webView.CanScrollHorizontally(1), // at right edge
SwipeDirection.Down => !webView.CanScrollVertically(-1), // at top
SwipeDirection.Up => !webView.CanScrollVertically(1), // at bottom
_ => true,
};
@kubaflo

kubaflo commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

/backport to release/10.0.1xx-sr9

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/10.0.1xx-sr9 (link to workflow run)

rmarinho pushed a commit that referenced this pull request Jul 10, 2026
)

Backport of #36499 to release/10.0.1xx-sr9

/cc @kubaflo

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in .NET MAUI 10.0.80: WebView inside SwipeView no longer responds to swipe gestures

4 participants