Skip to content

[weview_flutter][iOS] Webview not response to click or tap after dismissed PopupMenuButton #177306

@YuxuanDu

Description

@YuxuanDu

Steps to reproduce

  1. Add webview_flutter 4.13.0 to project
  2. Implement webview together with a PopupMenuButton on the same page (see the code block below) and run it on a real iOS device (I tried with my phone running iOS 26.0.1)
  3. Initially, the webview response to every link/button tap.
  4. Tap on the PopupMenuButton to open the menu.
  5. Dismiss the menu by tapping on any webview content area to dismiss the menu
  6. (repeat 4 and 5 a couple times if the issue doesn't occur)
  7. Tap on any link/button in the webview content.
  8. Webview not response to the click/tap event

Expected results

Webview should always response to the click/tap event after PopupMenuButton dismissed.

Actual results

Webview not response to the click/tap event

Code sample

Code sample
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  runApp(MainApp());
}

class MainApp extends StatefulWidget {
  MainApp({super.key});

  @override
  State<MainApp> createState() => _MainAppState();
}

class _MainAppState extends State<MainApp> {
  WebViewController? controller;

  SampleItem? selectedItem;

  @override
  void initState() {
    controller = WebViewController()
      ..setJavaScriptMode(JavaScriptMode.unrestricted)
      ..setBackgroundColor(const Color(0x00000000))
      ..setNavigationDelegate(
        NavigationDelegate(
          onProgress: (int progress) {
            // Update loading bar.
          },
          onPageStarted: (String url) {},
          onPageFinished: (String url) {},
          onWebResourceError: (WebResourceError error) {},
          onNavigationRequest: (NavigationRequest request) {
            return NavigationDecision.navigate;
          },
        ),
      )
      ..loadRequest(Uri.parse('https://google.com'));
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: Text("Testing app"),
            actions: [
              PopupMenuButton<SampleItem>(
                initialValue: selectedItem,
                onSelected: (SampleItem item) {
                  setState(() {
                    selectedItem = item;
                  });
                },
                itemBuilder: (BuildContext context) =>
                    <PopupMenuEntry<SampleItem>>[
                  const PopupMenuItem<SampleItem>(
                      value: SampleItem.itemOne, child: Text('Item 1')),
                  const PopupMenuItem<SampleItem>(
                      value: SampleItem.itemTwo, child: Text('Item 2')),
                  const PopupMenuItem<SampleItem>(
                      value: SampleItem.itemThree, child: Text('Item 3')),
                ],
              )
            ],
          ),
          body: WebViewWidget(controller: controller!)),
    );
  }
}

enum SampleItem { itemOne, itemTwo, itemThree }

Screenshots or Video

Screenshots / Video demonstration
new.mov

Logs

Logs

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.35.5, on macOS 15.5 24F74 darwin-arm64, locale en-AU) [411ms]
    • Flutter version 3.35.5 on channel stable at /Users/123/ProgrammingTools/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ac4e799d23 (4 weeks ago), 2025-09-26 12:05:09 -0700
    • Engine revision d3d45dcf25
    • Dart version 3.9.2
    • DevTools version 2.48.0
    • Feature flags: no-enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-lldb-debugging

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [2.5s]
    • Android SDK at /Users/123/Library/Android/sdk
    • Emulator version 35.4.9.0 (build_id 13025442) (CL:N/A)
    • Platform android-36, build-tools 35.0.0
    • ANDROID_HOME = /Users/123/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [939ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

[✓] Android Studio (version 2025.1) [7ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)

[✓] VS Code (version 1.105.1) [6ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.120.0

[✓] Connected device (3 available) [6.0s]
    • iPhone 15 Pro (mobile)          • ios          • iOS 26.0.1 23A355

[✓] Network resources [1,216ms]
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    found in release: 3.35Found to occur in 3.35found in release: 3.38Found to occur in 3.38frameworkflutter/packages/flutter repository. See also f: labels.fyi-ecosystemFor the attention of Ecosystem teamhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: webviewThe WebView pluginpackageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallyr: duplicateIssue is closed as a duplicate of an existing issueteam-iosOwned by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions