Skip to content

[webview_flutter] Register the iOS platform view with the hit-test gesture blocking policy - #12495

Closed
burakimdatt wants to merge 1 commit into
flutter:mainfrom
burakimdatt:webview-hittest-gesture-policy
Closed

[webview_flutter] Register the iOS platform view with the hit-test gesture blocking policy#12495
burakimdatt wants to merge 1 commit into
flutter:mainfrom
burakimdatt:webview-hittest-gesture-policy

Conversation

@burakimdatt

Copy link
Copy Markdown

Registers the iOS platform view with FlutterPlatformViewGestureRecognizersBlockingPolicyDoNotBlockGesture instead of relying on the default eager policy.

eager blocks the platform view's gesture recognizers through Flutter's gesture arena, which is stateful. If that state is stranded the web view stops receiving touches for the rest of its lifetime. The engine used to recover from this in ForwardingGestureRecognizer.forceResetStateIfNeeded, but that reset returns early on iOS 26 and above (see flutter/flutter#179907), so on iOS 26 there is nothing left to recover it.

doNotBlockGesture derives the same blocking decision from hitTest rather than the arena, and does not install the delaying recognizer at all — so there is no recognizer state to strand. Blocking behaviour itself is preserved: FlutterTouchInterceptingView.hitTest still consults platformViewShouldAcceptTouchAtTouchBeganLocation: and returns itself when a Flutter widget is on top, and the forwarding recognizer is still installed so Flutter's arena keeps seeing the touches.

Verified on iOS 26.3 simulator, iOS 26.4 simulator and an iOS 26.6 device: the web view is unresponsive after the first interaction without this change, and behaves correctly with it.

Fixes flutter/flutter#191261

Open question for the reviewer: this change is unconditional rather than gated behind if #available(iOS 26.0, *). I went that way because it is not iOS-26-specific in principle — the arena state can be stranded on any version, iOS 26 just removed the net that used to hide it — and because it matches the direction described in flutter/flutter#175099 ("help prevent regressions even if this WebKit bug happens again"). Happy to add a version gate instead if you would rather keep the blast radius smaller.

Pre-Review Checklist

@google-cla

google-cla Bot commented Aug 18, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates WebViewFlutterPlugin.swift on iOS to register the web view factory using the FlutterPlatformViewGestureRecognizersBlockingPolicyDoNotBlockGesture policy. A corresponding unit test has been added to FWFWebViewFlutterWKWebViewExternalAPITests.swift to verify this policy registration, and the package version is bumped to 3.26.1 in pubspec.yaml and CHANGELOG.md. There are no review comments, so there is no feedback to provide.

…sture policy

The default eager policy blocks the platform view's gesture recognizers
through Flutter's stateful gesture arena. When that state is stranded the
web view stops receiving touches for the rest of its lifetime, which
reproduces on iOS 26 where the engine's stuck-state reset is disabled.

The doNotBlockGesture policy derives the same blocking decision from hit
testing, so there is no recognizer state left to strand.
@burakimdatt
burakimdatt force-pushed the webview-hittest-gesture-policy branch from 939baac to e28f33a Compare August 18, 2026 15:13
@burakimdatt

Copy link
Copy Markdown
Author

Closing this — I opened it from the wrong account. Reopening from the GitHub account associated with my signed CLA. Sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[webview_flutter][iOS] Platform view stops receiving touches after the first interaction on iOS 26

2 participants