Skip to content

[webview_flutter] The click event is not pressed on iOS 18.2. #160900

@ttb-inc

Description

@ttb-inc

Steps to reproduce

See the sample code.

  1. Try pressing the button in the webview (checks OK)
  2. Try pressing the FloatingActionButton '+' (UI event)
  3. Try pressing the button in the webview again (to check for errors).
  4. After pressing the 'Reload' button, reload the webview.
  5. Try pressing the button in the webview (checks OK)

Expected results

...

Actual results

After the event of the flutter Button UI is pressed, the event of the webview is not pressed.

The error occurs only on iOS 18.2.
Works fine on iOS 18.1.1 and earlier.

If I'm doing something wrong or need additional options, please help.
Thanks a lot.

Code sample

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  late InAppWebViewController _webviewController;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
        leading: FloatingActionButton(
          onPressed: () {
            ///
            /// After reloading, the webview's events(e.g. onclick) will work again.
            ///
            _webviewController.reload();
          },
          child: const Icon(Icons.refresh),
        ),
      ),
      body: InAppWebView(
        initialUrlRequest: URLRequest(
          url: WebUri('https://google.com/'),
        ),
        onWebViewCreated: (controller) {
          _webviewController = controller;
        },
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          ///
          /// When a button input event is pressed, the webview's events(e.g. onclick) will stop working.
          ///
        },
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[!] Flutter (Channel [user-branch], 3.24.5, on macOS 15.1.1 24B91 darwin-arm64, locale ko-KR)
    ! Flutter version 3.24.5 on channel [user-branch] at /Users/jeonglockpark/Desktop/work/flutter_sdk/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.96.2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions