Skip to content

webview_flutter: Nested scrolling with WebView no longer works #35394

@droidery

Description

@droidery

Internal: b/159169562

Steps to Reproduce

  1. Place WebView inside ConstrainedBox (to give WebView a fixed height) inside ListView. Add required gestureRecognizers (to win vertical scroll).
  2. Run app
  3. Cannot scroll vertically

This seems to be a regression as the scrolling doesn't work on master but if I pick an arbitrary older Flutter version from May 2019 (using git checkout 34325ba33a05a6a0af07e1813377703e8a6e328e) or use flutter channel stable scrolling works perfectly.

Sample app (with dependency on webview_flutter: ^0.3.9+1):

import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: WebViewSample(),
      ),
    );
  }
}

class WebViewSample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ListView(
      children: <Widget>[
        ConstrainedBox(
          constraints: BoxConstraints(maxHeight: 200.0),
          child: WebView(
            gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
              Factory<VerticalDragGestureRecognizer>(
                () => VerticalDragGestureRecognizer(),
              ),
            },
            initialUrl: Uri.dataFromString(
              '<p>Web view sample</p>' * 1000,
            ).toString(),
          ),
        )
      ],
    );
  }
}

Logs

[   +4 ms] 🔥  To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R".
[   +1 ms] An Observatory debugger and profiler on Android SDK built for x86 is available at: http://127.0.0.1:65463/PepkWGgfEXQ=/
[        ] For a more detailed help message, press "h". To detach, press "d"; to quit, press "q".
[  +22 ms] W/cr_ChildProcLH( 7466): Create a new ChildConnectionAllocator with package name = com.android.chrome, sandboxed = true
[  +10 ms] I/cr_BrowserStartup( 7466): Initializing chromium process, singleProcess=false
[ +344 ms] W/le.webview_tes( 7466): Accessing hidden method
Landroid/view/textclassifier/logging/SmartSelectionEventTracker;-><init>(Landroid/content/Context;I)V (light greylist, reflection)
[        ] W/le.webview_tes( 7466): Accessing hidden method
Landroid/view/textclassifier/logging/SmartSelectionEventTracker;->logEvent(Landroid/view/textclassifier/logging/SmartSelectionEventTracker$Se
lectionEvent;)V (light greylist, reflection)
[        ] W/le.webview_tes( 7466): Accessing hidden method
Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionStarted(I)Landroid/view/textclassifier/logging/Smar
tSelectionEventTracker$SelectionEvent; (light greylist, reflection)
[        ] W/le.webview_tes( 7466): Accessing hidden method
Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(II)Landroid/view/textclassifier/logging/Sm
artSelectionEventTracker$SelectionEvent; (light greylist, reflection)
[        ] W/le.webview_tes( 7466): Accessing hidden method
Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(IILandroid/view/textclassifier/TextClassif
ication;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
[        ] W/le.webview_tes( 7466): Accessing hidden method
Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(IILandroid/view/textclassifier/TextSelecti
on;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
[        ] W/le.webview_tes( 7466): Accessing hidden method
Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionAction(III)Landroid/view/textclassifier/logging/Sma
rtSelectionEventTracker$SelectionEvent; (light greylist, reflection)
[        ] W/le.webview_tes( 7466): Accessing hidden method
Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionAction(IIILandroid/view/textclassifier/TextClassifi
cation;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
[  +50 ms] W/cr_media( 7466): Requires BLUETOOTH permission
[ +106 ms] D/        ( 7466): HostConnection::get() New Host Connection established 0xba20eb00, tid 7558
[        ] D/EGL_emulation( 7466): eglCreateContext: 0xce211da0: maj 3 min 0 rcv 3
[        ] D/EGL_emulation( 7466): eglMakeCurrent: 0xce211da0: ver 3 0 (tinfo 0xbab60d90)
[ +230 ms] D/EGL_emulation( 7466): eglMakeCurrent: 0xe2b05e40: ver 3 0 (tinfo 0xca840df0)
[        ] D/EGL_emulation( 7466): eglMakeCurrent: 0xe2b05e40: ver 3 0 (tinfo 0xca840df0)
[   +2 ms] W/cr_CrashFileManager( 7466): /data/user/0/com.example.webview_test/cache/WebView/Crash Reports does not exist or is not a
directory
[  +15 ms] W/VideoCapabilities( 7466): Unrecognized profile 4 for video/hevc
[  +35 ms] I/VideoCapabilities( 7466): Unsupported profile 4 for video/mp4v-es
[  +11 ms] W/cr_MediaCodecUtil( 7466): HW encoder for video/avc is not available on this device.
[ +350 ms] D/EGL_emulation( 7466): eglCreateContext: 0xb9f5f840: maj 3 min 0 rcv 3
[        ] D/EGL_emulation( 7466): eglMakeCurrent: 0xb9f5f840: ver 3 0 (tinfo 0xbab60d90)
[  +68 ms] D/EGL_emulation( 7466): eglMakeCurrent: 0xe2b05e40: ver 3 0 (tinfo 0xca840df0)
Analyzing webview_test...
No issues found! (ran in 3.5s)
flutter doctor -v
[✓] Flutter (Channel master, v1.7.12-pre.42, on Mac OS X 10.14.5 18F132, locale en-US)
    • Flutter version 1.7.12-pre.42 at /Users/droidery/flutter
    • Framework revision 9e1b4b22c2 (2 hours ago), 2019-06-30 22:40:09 -0700
    • Engine revision e96900df2f
    • Dart version 2.4.0


[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/droidery/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 10.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2.1, Build version 10E1001
    • CocoaPods version 1.7.3

[!] iOS tools - develop for iOS devices
    ✗ Verify that all connected devices have been paired with this computer in Xcode.
      If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
      To update with Brew, run:
        brew update
        brew uninstall --ignore-dependencies libimobiledevice
        brew uninstall --ignore-dependencies usbmuxd
        brew install --HEAD usbmuxd
        brew unlink usbmuxd
        brew link usbmuxd
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    • ios-deploy 1.9.4

[✗] Chrome - develop for the web (Cannot find chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! CHROME_EXECUTABLE not set

[✓] Android Studio (version 3.4)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 36.1.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[✓] IntelliJ IDEA Community Edition (version 2019.1.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 36.1.4
    • Dart plugin version 191.7830

[!] VS Code (version 1.35.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • Android SDK built for x86 • emulator-5554 • android-x86    • Android 9 (API 28) (emulator)
    • macOS                     • macOS         • darwin-x64     • Mac OS X 10.14.5
    • Chrome                    • chrome        • web-javascript • unknown (unsupported)

! Doctor found issues in 3 categories.

Metadata

Metadata

Assignees

Labels

P0Critical issues such as a build break or regressiona: platform-viewsEmbedding Android/iOS views in Flutter appsc: regressionIt was better in the past than it is nowcustomer: money (g3)f: gesturesflutter/packages/flutter/gestures repository.found in release: 1.20Found to occur in 1.20frameworkflutter/packages/flutter repository. See also f: labels.has 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 specificallywaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions