-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Open
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appsfound in release: 3.29Found to occur in 3.29Found to occur in 3.29found in release: 3.30Found to occur in 3.30Found to occur in 3.30has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team
Description
Note
This happens only on Android, tested it in the mean time on iOS and macOS.
Steps to reproduce
- Create an app with e.g. go router and WebView
- Create an input view in the WebView
- Navigate away
- Connect a mouse e.g. via BlueTooth wired should work with an adapter too
- Move the cursor, the cursor changes to the I beam when you are in the area of the input field
- When you click on the invisible input field the keyboard pops up
- When you enter something the key presses will be forwarded to the WebView
Expected results
Basically nothing, the WebView should not interference when it is not most top.
Actual results
You can control the invisible WebView.
Code sample
Code sample
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:webview_flutter/webview_flutter.dart';
void main() => runApp(const MyApp());
final GoRouter _router = GoRouter(
routes: <RouteBase>[
GoRoute(
path: '/',
builder: (BuildContext context, GoRouterState state) {
return const WebViewScreen();
},
routes: <RouteBase>[
GoRoute(
path: 'settings',
builder: (BuildContext context, GoRouterState state) {
return const SettingsScreen();
},
),
],
),
],
);
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp.router(routerConfig: _router);
}
}
class WebViewScreen extends StatelessWidget {
const WebViewScreen({super.key});
@override
Widget build(BuildContext context) {
final controller =
WebViewController()
..loadHtmlString('''
<meta name="viewport" content="width=device-width, initial-scale=1" />
<h1>WebView</h1>
<textarea style="width:90%; height:200px"></textarea>
''');
return Scaffold(
appBar: AppBar(
title: const Text('Home Screen'),
actions: [
IconButton(
icon: Icon(Icons.settings),
onPressed: () => context.go('/settings'),
),
],
),
body: WebViewWidget(controller: controller),
);
}
}
class SettingsScreen extends StatelessWidget {
const SettingsScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Settings')),
body: Center(child: Text('Fake settings page')),
);
}
}Relevant pubspec.yaml dependencies:
dependencies:
flutter:
sdk: flutter
go_router: ^14.8.1
webview_flutter: ^4.10.0Screenshots or Video
Screenshots / Video demonstration
webview-bug.mp4
Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.1, on macOS 15.3.1 24D70 darwin-arm64, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] IntelliJ IDEA Community Edition (version 2024.3.3)
[✓] VS Code (version 1.92.2)
[✓] Connected device (4 available)
[✓] Network resources
• No issues found!
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appsfound in release: 3.29Found to occur in 3.29Found to occur in 3.29found in release: 3.30Found to occur in 3.30Found to occur in 3.30has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team