|
// On iOS 18.2, WKWebView's internal recognizer likely caches the old state of its blocking |
|
// recognizers (i.e. delaying recognizer), resulting in non-tappable links. See |
|
// https://github.com/flutter/flutter/issues/158961. Removing and adding back the delaying |
|
// recognizer solves the problem, possibly because UIKit notifies all the recognizers related |
|
// to (blocking or blocked by) this recognizer. It is not possible to inject this workaround |
|
// from the web view plugin level. Right now we only observe this issue for |
|
// FlutterPlatformViewGestureRecognizersBlockingPolicyEager, but we should try it if a similar |
|
// issue arises for the other policy. |
|
if (@available(iOS 26.0, *)) { |
|
// This performs a nested DFS, with the outer one searching for any web view, and the inner |
|
// one searching for a TouchEventsGestureRecognizer inside the web view. Once found, disable |
|
// and immediately reenable it to reset its state. |
|
// TODO(hellohuanlin): remove this flag after it is battle tested. |
|
NSNumber* isWorkaroundDisabled = |
|
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"FLTDisableWebViewGestureReset"]; |
|
if (!isWorkaroundDisabled.boolValue) { |
|
[self searchAndFixWebView:self.embeddedView]; |
|
} |
|
} else if (@available(iOS 18.2, *)) { |
|
// The 1P web view plugin provides a WKWebView itself as the platform view. However, some 3P |
|
// plugins provide wrappers of WKWebView instead, and AdMob banner has a WKWebView at |
|
// depth 7. So we perform DFS to search the view hierarchy. |
|
if ([self containsWebView:self.embeddedView]) { |
|
[self removeGestureRecognizer:self.delayingRecognizer]; |
|
[self addGestureRecognizer:self.delayingRecognizer]; |
|
} |
|
} |
Apple fixed the non-tappable web view bug on iOS 26.4. This means we can skip the hacky workarounds on iOS 26.4
flutter/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Lines 653 to 679 in 8787e42