Skip to content

[desktop] Horizontal Scrolling Broken on windows and linux #83359

Closed

Description

Current behavior

This video shows the current behavior of scrolling on web (dekstop) since #81569 has been merged (I think). It is not immediately obvious what is going on, so here is what this shows:

  • You cannot scroll by dragging anymore.
  • You can scroll both vertically and horizontally using trackpads.
  • You can only scroll vertically using scroll wheels.
2021-05-25.16-51-26.mp4

What is broken

Since #81569, there are two major issues that come up because of this:

  1. On desktop devices without trackpad (i.e. with a regular mouse), you cannot scroll horizontally at all. This means that it is now impossible to reach some of the content (scroll the first item in the video).
  2. On some desktop devices with trackpad, horizontal scroll is also not possible. Some of our users report that it does not work for them anymore (internal product that is why using dev). I assume this is because the "trackpad" on their device works by immitating dragging (?).

→ in an attempt to fix #71322, #81569 (I think) made it impossible to scroll horizontally by breaking it on devices with a scroll wheel only (1.) and on some other devices (2.) even though they do have a trackpad.

Reproduction

I am not sure which devices cause 2. but I know that it has been introduced in one of the most recent dev update for our users (between 2.3.0-0.1.pre and 2.3.0-12.1.pre). The scroll wheel one is even more obvious - there are many features in our app partially broken because of this update.

Click to see code
import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      body: ListView.builder(
        itemBuilder: (context, index) {
          if (index == 0) {
            return SingleChildScrollView(
              scrollDirection: Axis.horizontal,
              child: SizedBox(
                height: 240,
                child: ColoredBox(
                  color: Colors.redAccent,
                  child: Center(
                    child: Text(
                      'This is a horizontally scrolling view. ' * 20,
                      style: const TextStyle(
                        color: Colors.white,
                        fontSize: 142,
                      ),
                    ),
                  ),
                ),
              ),
            );
          }
          return SizedBox(
            width: double.infinity,
            height: 120,
            child: ColoredBox(
              color: HSVColor.fromAHSV(1, (index * 45) % 360, 3 / 4, 3 / 4)
                  .toColor(),
            ),
          );
        },
      ),
    ),
  ));
}
Click to see flutter doctor
[✓] Flutter (Channel origin/dev, 2.3.0-12.1.pre, on Microsoft Windows [Version 10.0.19042.985], locale en-150)
    • Flutter version 2.3.0-12.1.pre
    • Upstream repository remotes
    • Framework revision f9c825981c (7 days ago), 2021-05-18 14:07:52 -0700
    • Engine revision 26e217e6c3
    • Dart version 2.14.0 (build 2.14.0-edge.a527411e5100a0a4f48c4009087a1b988aa784af)

Workaround

A workaround for this regression is adding:

ScrollConfiguration(
  behavior: ScrollConfiguration.of(context).copyWith(
    dragDevices: {
      PointerDeviceKind.mouse,
      PointerDeviceKind.touch,
    },
  ),
  child: HorizontalScrollView(...),
)

Everywhere where there is a horizontal scroll view. This cannot be the solution.

cc @jonahwilliams @Piinks @chunhtai

Activity

  1. creativecreatorormaybenot commented on May 25, 2021

    @creativecreatorormaybenot
    ContributorAuthor

    I found a migration guide through #82982, however, this is definitely a breaking change and only addresses 1. (in some minor capacity) but not 2.

  2. creativecreatorormaybenot commented on May 25, 2021

    @creativecreatorormaybenot
    ContributorAuthor

    Also @TahaTesser mentioned this in #83065 (comment):

    Since PageView is scrollable horizontally, you need to press Shift + Scroll. For the vertical list, you can just scroll as usual.

    However, this is not true at all for me - i.e. using shift does not change anything in the reproducible sample for me - it will still only scroll horizontally.


    Even considering everything #82982, #83065, and flutter/website#5771, I still consider both 1. and 2. as fully open (and not duplicates).
    This is because for 1. scrolling with shift does not work for horizontal scroll and for 2. trackpad is now also broken for some of our users.

  3. TahaTesser commented on May 26, 2021

    @TahaTesser
    Contributor

    Hi @creativecreatorormaybenot
    Thanks for filing the issue.
    I used macOS to reproduce #83065, shift + scroll works fine on macOS.

    However testing your code sample on three desktop platforms, I can see the shift + scroll doesn't work on windows and linux but works on macOS even when using your code sample

    It's not just web but desktop, behaviour is same

    macOS

    Hold shift + scroll
    flutter doctor -v
    [✓] Flutter (Channel master, 2.3.0-13.0.pre.163, on macOS 11.3.1 20E241
        darwin-x64, locale en-GB)
        • Flutter version 2.3.0-13.0.pre.163 at
          /Users/tahatesser/Code/flutter_master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 21e4a94703 (5 hours ago), 2021-05-26 01:30:47 -0400
        • Engine revision 9d919e15f7
        • Dart version 2.14.0 (build 2.14.0-145.0.dev)
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /Volumes/Extreme/SDK
        • Platform android-30, build-tools 30.0.3
        • ANDROID_HOME = /Volumes/Extreme/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 at /Volumes/Extreme/Xcode.app/Contents/Developer
        • Xcode 12.5, Build version 12E262
        • CocoaPods version 1.10.1
    [✓] 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.1.1)
        • IntelliJ at /Volumes/Extreme/IntelliJ IDEA CE.app
        • Flutter plugin version 56.0.5
        • Dart plugin version 211.7233
    [✓] VS Code (version 1.56.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.22.0
    [✓] Connected device (3 available)
        • Taha's iPhone (mobile) • 00008020-001059882212002E • ios            • iOS
          14.6
        • macOS (desktop)        • macos                     • darwin-x64     •
          macOS 11.3.1 20E241 darwin-x64
        • Chrome (web)           • chrome                    • web-javascript •
          Google Chrome 90.0.4430.212
    • No issues found!

    windows

    Hold shift + scroll
    flutter doctor -v
    [✓] Flutter (Channel master, 2.3.0-13.0.pre.164, on Microsoft Windows [Version 10.0.19043.985], locale en-US)
        • Flutter version 2.3.0-13.0.pre.164 at C:\Users\Taha\Code\flutter_master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 5e646717c8 (4 hours ago), 2021-05-26 02:39:02 -0400
        • Engine revision 221623d2bb
        • Dart version 2.14.0 (build 2.14.0-151.0.dev)
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at C:\Users\Taha\Code\SDK
        • Platform android-30, build-tools 30.0.3
        • ANDROID_SDK_ROOT = C:\Users\Taha\Code\SDK
        • Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
        • All Android licenses accepted.
    
    [✓] Chrome - develop for the web
        • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
    
    [✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.6)
        • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
        • Visual Studio Community 2019 version 16.9.31313.79
        • Windows 10 SDK version 10.0.19041.0
    
    [✓] Android Studio (version 4.2.0)
        • Android Studio at C:\Users\Taha\Code\android-studio
        • 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.6842174)
    
    [✓] IntelliJ IDEA Community Edition (version 2021.1)
        • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.1.1
        • 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
    
    [✓] VS Code (version 1.56.2)
        • VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.22.0
    
    [✓] Connected device (4 available)
        • Windows (desktop)       • windows • windows-x64     • Microsoft Windows [Version 10.0.19043.985]
        • Windows (UWP) (desktop) • winuwp  • windows-uwp-x64 •
        • Chrome (web)            • chrome  • web-javascript  • Google Chrome 90.0.4430.212
        • Edge (web)              • edge    • web-javascript  • Microsoft Edge 90.0.818.66
    
    • No issues found!

    linux

    Hold shift + scroll
    flutter doctor -v
    [✓] Flutter (Channel master, 2.3.0-13.0.pre.163, on Pop!_OS 20.10
        5.11.0-7614-generic, locale en_US.UTF-8)
        • Flutter version 2.3.0-13.0.pre.163 at /home/taha/Code/flutter_master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 21e4a94703 (5 hours ago), 2021-05-26 01:30:47 -0400
        • Engine revision 9d919e15f7
        • Dart version 2.14.0 (build 2.14.0-145.0.dev)
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /home/taha/Code/SDK
        • Platform android-30, build-tools 30.0.3
        • ANDROID_HOME = /home/taha/Code/SDK
        • Java binary at: /home/taha/Code/android-studio/jre/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.8+0-b944-P17168821)
        • All Android licenses accepted.
    [✓] Chrome - develop for the web
        • Chrome at google-chrome
    [✓] Linux toolchain - develop for Linux desktop
        • Ubuntu clang version 11.0.0-2
        • cmake version 3.16.3
        • ninja version 1.8.2
        • pkg-config version 0.29.2
    [✓] Android Studio (version 4.2)
        • Android Studio at /home/taha/Code/android-studio
        • Flutter plugin version 56.0.2
        • Dart plugin version 202.8488
        • Java version OpenJDK Runtime Environment (build 11.0.8+0-b944-P17168821)
    [✓] IntelliJ IDEA Community Edition (version 2021.1)
        • IntelliJ at /home/taha/Code/idea
        • Flutter plugin version 56.0.5
        • Dart plugin version 211.7233
    [✓] VS Code (version 1.56.2)
        • VS Code at /usr/share/code
        • Flutter extension version 3.22.0
    [✓] Connected device (2 available)
        • Linux (desktop) • linux  • linux-x64      • Pop!_OS 20.10
          5.11.0-7614-generic
        • Chrome (web)    • chrome • web-javascript • Google Chrome 90.0.4430.212
    • No issues found!
  4. changed the title [-][web] Horizontal Scrolling Broken[/-] [+][desktop] Horizontal Scrolling Broken on windows and linux[/+] on May 26, 2021
  5. added
    engineflutter/engine related. See also e: labels.
    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
    platform-linuxBuilding on or for Linux specifically
    platform-windowsBuilding on or for Windows specifically
    and removed
    engineflutter/engine related. See also e: labels.
    in triagePresently being triaged by the triage team
    on May 26, 2021
  6. 12 remaining items

  7. talski commented on May 28, 2021

    @talski

    How can I re-enable scroll by dragging on entire web app? Tried to set scrollBehavior in MaterialApp but it doesn't work

  8. Piinks commented on Jun 2, 2021

    @Piinks
    Contributor

    The shift+mouseScroll issue is being tracked in #75180. It is currently implemented in the engine for macOS AFAIK and support needs to be added for Windows and Linux. This was discussed as a potential blocker to landing this feature, but instead we found a non-breaking way to move forward and planned a migration guide for those that desired the previous behavior while we move on to work on better horizontal scrolling support.

    Also AFAIK, trackpad gestures are treated as pointer mouse scrolls. This is because trackpad support has not yet been implemented in flutter. That is being tracked in #23604 I believe.

    The behavior that was changed in #81569 can be completely restored to the previous behavior by setting ScrollBehavior.dragDevices to PointerDeviceKind.values to allow all devices to drag. Making this change is covered in the migration guide that is open in flutter/website#5771

    #81569 was not found to be a breaking change in the course of development in accordance with our breaking change policy. We do welcome everyone to contribute to flutter/tests to help us better identify breaking changes though. These tests are run against every flutter change before it lands to avoid breaks.

    The trackpad and shift+mouseScroll issues appear to be covered by the other linked issues. I think we can close this issue then unless there are any other outstanding issues here. The other features that remain to be implemented are part of our ongoing journey to reach stable desktop. :)

    For more context around this change, see #81832 as well.

  9. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    and removed
    c: regressionIt was better in the past than it is now
    on Jun 2, 2021
  10. creativecreatorormaybenot commented on Jun 2, 2021

    @creativecreatorormaybenot
    ContributorAuthor

    @Piinks thanks for taking a look at it 🙏

    This roughly sounds right, but as I said this seemed to be breaking for some of our users because their trackpads were no longer detected.

    Also for me personally, I cannot use it at all because we cannot scroll precisely, but I am fine with this being tracked in another issue. Just overall, after having it rolled out to our internal users, it became clear that this was breaking the app for too many users and we had to revert to the old behavior. I think this might cause a lot of problems when rolling the feature onto stable in this state.

  11. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jun 2, 2021
  12. Piinks commented on Jun 2, 2021

    @Piinks
    Contributor

    This seemed to be breaking for some of our users because their trackpads were no longer detected.

    I expect when we add official trackpad support this will be consistent. :)

    I think this might cause a lot of problems when rolling the feature onto stable in this state.

    This feature will only affect desktop platforms, which are not yet supported on the stable channel. We currently do not recommend releasing a desktop application to production until it has reached the stable channel. You can read more about this in our desktop documentation.

    I am fine with this being tracked in another issue

    I am going to close this then. Please track the outlying features in the linked bugs above. If anything else comes up regarding this issue, please do not hesitate to re-open so we can discuss further! Thank you! :)

  13. creativecreatorormaybenot commented on Jun 2, 2021

    @creativecreatorormaybenot
    ContributorAuthor

    This feature will only affect desktop platforms, which are not yet supported on the stable channel. We currently do not recommend releasing a desktop application to production until it has reached the stable channel. You can read more about this in our desktop documentation.

    @Piinks actually, we are experiencing this issue on Flutter web and that is stable - or not?

  14. timsneath commented on Jun 2, 2021

    @timsneath

    Are you experiencing something broken on the stable channel?

  15. creativecreatorormaybenot commented on Jun 2, 2021

    @creativecreatorormaybenot
    ContributorAuthor

    @timsneath no, I am sorry if this was a misunderstanding.

    We have an internal app that uses the beta/dev channel (allows us to use the latest features and prepare for changes hitting stable in advance). In this app, some of our internal users reported not being able to scroll anymore (after #81569 was merged in).
    Investigating this, some of the users simply used to scroll by dragging: we could explain to them that they can use the trackpad, however, for some other users, their trackpad was not working anymore in the Flutter web app after #81569.


    After applying:

    behavior: ScrollConfiguration.of(context).copyWith(
      dragDevices: PointerDeviceKind.values,
    ),

    We were able to restore the previous behavior and also fix the trackpad issues for our internal users. However, I imagine that when this change lands on stable, a lot of apps will break before they figure out how to work around this "regression".

  16. timsneath commented on Jun 3, 2021

    @timsneath

    Thanks! In general, if we make a breaking change between stable releases, we post a breaking change announcement here by the time we ship to stable: https://flutter.dev/docs/release/breaking-changes

    As you know, if you're on an unstable channel, then you sign up to join us in the jeweler's workshop, where things can be a little more messy and not everything gem is polished :)

  17. github-actions commented on Jul 31, 2021

    @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.

  18. locked as resolved and limited conversation to collaborators on Jul 31, 2021
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

    P2Important issues not at the top of the work lista: desktopRunning on desktopf: scrollingViewports, list views, slivers, etc.found in release: 2.3Found to occur in 2.3frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-linuxBuilding on or for Linux specificallyplatform-windowsBuilding on or for Windows specifically

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions