Skip to content

Scrollbar hittest penetration issue #99324

Closed

Description

@xu-baolin

Code

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      scrollBehavior: MyScrollBehavior(),
      home: Scaffold(
        body: Center(
          child: SizedBox(
            width: 200,
            height: 200,
            child: Scrollbar(
              // interactive: false,
              thumbVisibility: true,
              trackVisibility: true,
              child: SingleChildScrollView(
                child: GestureDetector(
                  onTap: () => print('onTap'),
                  child: const FlutterLogo(
                    size: 300,
                  ),
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}

class MyScrollBehavior extends ScrollBehavior {

  @override
  Widget buildScrollbar(BuildContext context, Widget child, ScrollableDetails details) {
    return child;
  }
}

Expect

Do not output onTap log if tap the track rectangle area.

Actual

Output onTap log if tap on the scrollbar track area.

Activity

  1. added
    a: mouseIssues related to using a mouse or mouse support
    and removed
    a: mouseIssues related to using a mouse or mouse support
    on Mar 1, 2022
  2. maheshj01 commented on Mar 1, 2022

    @maheshj01
    Member

    Hi @xu-baolin, Thanks for filing the issue. I am able to reproduce the issue on the latest master channel tapping on the scrollBar track triggers onTap on the child. This is reproducible on mobile platforms too.

    Screen.Recording.2022-03-01.at.5.13.30.PM.mov
    Launching lib/main.dart on macOS in debug mode...
    objc[47000]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1f9456b90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1043042c8). One of the two will be used. Which one is undefined.
    objc[47000]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1f9456be0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104304318). One of the two will be used. Which one is undefined.
    --- xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:macOS, arch:x86_64, id:00008103-0019553C36F2001E }
    { platform:macOS, name:Any Mac }
    Connecting to VM Service at ws://127.0.0.1:54384/ktHgdjvL3MY=/ws
    flutter: onTap
    flutter: onTap
    
    flutter doctor -v (mac)
    [✓] Flutter (Channel master, 2.11.0-0.0.pre.715, on macOS 12.1 21C52 darwin-arm, locale en-GB)
        • Flutter version 2.11.0-0.0.pre.715 at /Users/mahesh/Documents/flutter_master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 8b95cd6f35 (7 hours ago), 2022-02-28 16:31:12 -0800
        • Engine revision 615a60512c
        • Dart version 2.17.0 (build 2.17.0-150.0.dev)
        • DevTools version 2.11.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /Users/mahesh/Library/Android/sdk
        • Platform android-31, build-tools 31.0.0
        • ANDROID_HOME = /Users/mahesh/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
        • All Android licenses accepted.
    
    [!] Xcode - develop for iOS and macOS (Xcode 13.2.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! CocoaPods 1.10.2 out of date (1.11.0 is recommended).
            CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on
            the Dart side.
            Without CocoaPods, plugins will not work on iOS or macOS.
            For more info, see https://flutter.dev/platform-plugins
          To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.2)
        • 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 11.0.8+10-b944.6916264)
    
    [✓] IntelliJ IDEA Community Edition (version 2021.2.1)
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • Flutter plugin version 61.2.4
        • Dart plugin version 212.5080.8
    
    [✓] VS Code (version 1.63.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.34.0
    
    [✓] Connected device (4 available)
        • Redmi K20 Pro (mobile) • 192.168.1.2:5555                     • android-arm64  • Android 11 (API 30)
        • iPhone 13 Pro (mobile) • CBEF6BFA-D3DC-4680-8900-E01C62A4B04C • ios            •
          com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
        • macOS (desktop)        • macos                                • darwin-arm64   • macOS 12.1 21C52 darwin-arm
        • Chrome (web)           • chrome                               • web-javascript • Google Chrome 98.0.4758.109
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
  3. added
    f: scrollingViewports, list views, slivers, etc.
    frameworkflutter/packages/flutter repository. See also f: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    and removed
    in triagePresently being triaged by the triage team
    on Mar 1, 2022
  4. added
    r: fixedIssue is closed as already fixed in a newer version
    on Mar 3, 2022
  5. github-actions commented on Mar 17, 2022

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: scrollingViewports, list views, slivers, etc.found in release: 2.11Found to occur in 2.11frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions