diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue18716.xaml b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue18716.xaml
new file mode 100644
index 000000000000..012fa697ca16
--- /dev/null
+++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue18716.xaml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue18716.xaml.cs b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue18716.xaml.cs
new file mode 100644
index 000000000000..4e7ff6bd6e07
--- /dev/null
+++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue18716.xaml.cs
@@ -0,0 +1,30 @@
+using Microsoft.Maui.Controls;
+
+namespace Maui.Controls.Sample.Issues
+{
+ [Issue(IssueTracker.Github, 18716, "Touch events are not working on WebView when a PDF is displayed", PlatformAffected.iOS)]
+ public partial class Issue18716 : ContentPage
+ {
+ public Issue18716()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnAppearing()
+ {
+ base.OnAppearing();
+ WaitForStubControl.Navigating += OnWebViewNavigating;
+ }
+
+ protected override void OnDisappearing()
+ {
+ base.OnDisappearing();
+ WaitForStubControl.Navigating -= OnWebViewNavigating;
+ }
+
+ void OnWebViewNavigating(object sender, WebNavigatingEventArgs e)
+ {
+ LoadedControl.Text = "Ready";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Controls/tests/UITests/Tests/Issues/Issue18716.cs b/src/Controls/tests/UITests/Tests/Issues/Issue18716.cs
new file mode 100644
index 000000000000..8c2cd4cf7588
--- /dev/null
+++ b/src/Controls/tests/UITests/Tests/Issues/Issue18716.cs
@@ -0,0 +1,30 @@
+using NUnit.Framework;
+using UITest.Appium;
+using UITest.Core;
+
+namespace Microsoft.Maui.AppiumTests.Issues
+{
+ public class Issue18716 : _IssuesUITest
+ {
+ public Issue18716(TestDevice device)
+ : base(device)
+ { }
+
+ public override string Issue => "Touch events are not working on WebView when a PDF is displayed";
+
+ [Test]
+ [Category(UITestCategories.WebView)]
+ public void CanScrollWebView()
+ {
+ this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.Windows });
+
+ App.WaitForElement("LoadedControl", timeout: TimeSpan.FromSeconds(1));
+ var result = App.FindElement("LoadedControl").GetText();
+ Assert.AreEqual("Ready", result);
+
+ App.WaitForElement("WaitForStubControl");
+ App.ScrollDown("WaitForStubControl", ScrollStrategy.Gesture, 0.75);
+ App.Screenshot("Scrolling has been done correctly.");
+ }
+ }
+}
diff --git a/src/Core/src/Platform/iOS/LayoutView.cs b/src/Core/src/Platform/iOS/LayoutView.cs
index 71718457c60a..745b0494c4d2 100644
--- a/src/Core/src/Platform/iOS/LayoutView.cs
+++ b/src/Core/src/Platform/iOS/LayoutView.cs
@@ -1,3 +1,5 @@
+using System;
+using System.Linq;
using CoreGraphics;
using UIKit;
@@ -6,7 +8,7 @@ namespace Microsoft.Maui.Platform
public class LayoutView : MauiView
{
bool _userInteractionEnabled;
-
+
public override void SubviewAdded(UIView uiview)
{
InvalidateConstraintsCache();
@@ -26,9 +28,11 @@ public override void WillRemoveSubview(UIView uiview)
var result = base.HitTest(point, uievent);
if (result is null)
+ {
return null;
+ }
- if (!_userInteractionEnabled && this.Equals(result))
+ if (!_userInteractionEnabled && Equals(result))
{
// If user interaction is disabled (IOW, if the corresponding Layout is InputTransparent),
// then we exclude the LayoutView itself from hit testing. But it's children are valid
@@ -37,11 +41,10 @@ public override void WillRemoveSubview(UIView uiview)
return null;
}
- if (!result.UserInteractionEnabled)
+ if (Subviews.Contains(result) && !result.UserInteractionEnabled)
{
// If the child also has user interaction disabled (IOW the child is InputTransparent),
- // then we also want to exclude it from the hit testing.
-
+ // then we also want to exclude it from the hit testing. }
return null;
}
diff --git a/src/TestUtils/src/UITest.Appium/HelperExtensions.cs b/src/TestUtils/src/UITest.Appium/HelperExtensions.cs
index 4acac365e99b..e99caac17f61 100644
--- a/src/TestUtils/src/UITest.Appium/HelperExtensions.cs
+++ b/src/TestUtils/src/UITest.Appium/HelperExtensions.cs
@@ -34,11 +34,6 @@ public static void Click(this IApp app, string element)
app.FindElement(element).Click();
}
- public static void Tap(this IApp app, string element)
- {
- app.FindElement(element).Click();
- }
-
public static string? GetText(this IUIElement element)
{
var response = element.Command.Execute("getText", new Dictionary()