Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrollbars should be always visible and instantiated by default on web and desktop #40107

Open
theacodes opened this issue Sep 9, 2019 · 25 comments · May be fixed by #75354
Open

Scrollbars should be always visible and instantiated by default on web and desktop #40107

theacodes opened this issue Sep 9, 2019 · 25 comments · May be fixed by #75354

Comments

@theacodes
Copy link

@theacodes theacodes commented Sep 9, 2019

As mentioned in #38795, the the browser's scrollbar isn't currently visible when content can be scrolled. Ideally, we'd show the scrollbar when content can be scrolled otherwise this breaks users expectations on the platform.

@ferhatb ferhatb added the platform-web label Sep 9, 2019
@mdebbar mdebbar added this to the Goals milestone Sep 12, 2019
@sudip4036
Copy link

@sudip4036 sudip4036 commented Dec 12, 2019

Any active development is in progress for this feature. We are using Flutter widget as a component in existing web page but the issue is it is disabling browser scrollbar.

@Sun3
Copy link

@Sun3 Sun3 commented Sep 18, 2020

I am trying to get a clarification since there is no milestone setup for the Flutter for the web to have the default scrollbar visible. Is this something that is planned for Flutter for the web to handle?

Thank you.

@jaredbaszler
Copy link

@jaredbaszler jaredbaszler commented Sep 18, 2020

I am trying to get a clarification since there is no milestone setup for the Flutter for the web to have the default scrollbar visible. Is this something that is planned for Flutter for the web to handle?

Thank you.

You'll just have to follow this issue to keep track of the progress. Since there is no milestone assigned it likely isn't at the top of the list and/or it isn't easy to implement. So I'd say at this point, I wouldn't expect this to get resolved anytime soon.

@Sun3
Copy link

@Sun3 Sun3 commented Sep 18, 2020

@jaredbaszler Thanks...

@adrian-moisa
Copy link

@adrian-moisa adrian-moisa commented Oct 4, 2020

That's a big issue to address. I picked up flutter with the goal of rendering "web first" and then other devices. Meaning that if web does not work for me it's a big issue. My MVP depends on web working successfully in the early MVP life time and less so on the mobile platforms. Scrolls are super important for UX. I find this is an essential feature to have for the web. Please add priority to this request.

@amirzolal
Copy link

@amirzolal amirzolal commented Oct 13, 2020

For the web (and desktop applications), the scrollbars are very important.

@Piinks Piinks self-assigned this Oct 20, 2020
@Piinks Piinks added this to the 1.26 - December 2020 milestone Oct 20, 2020
@Piinks Piinks added P3 and removed P5 labels Oct 20, 2020
@Piinks
Copy link
Contributor

@Piinks Piinks commented Oct 22, 2020

Hey @theacodes It looks like the Scrollbar.isAlwaysShown feature reached stable in version 1.17. Does this feature meet the need you described above? I have tried this on Mac, Web, and mobile, and I think it achieves the effect you described.

class _MyHomePageState extends State<MyHomePage> {
  final ScrollController scrollController = ScrollController();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Scrollbar(
        isAlwaysShown: true,
        controller: scrollController,
        child: ListView.builder(
          controller: scrollController,
          itemCount: 200,
          itemBuilder: (context, index) => ListTile(title: Text("Item= ${index + 1}"),),),
      )
    );
  }
}

flutter doctor -v

[✓] Flutter (Channel master, 1.24.0-2.0.pre.111, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-US)
    • Flutter version 1.24.0-2.0.pre.111 at /Users/katelovett/github/flutter
    • Framework revision fe189baf34 (14 hours ago), 2020-10-21 22:25:53 -0400
    • Engine revision f459a86610
    • Dart version 2.11.0 (build 2.11.0-242.0.dev)

[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/katelovett/Library/Android/sdk
    ✗ Flutter requires Android SDK 29 and the Android BuildTools 28.0.3
      To update the Android SDK visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions.
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C505
    • CocoaPods version 1.9.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 48.1.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.49.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.15.1

[✓] Connected device (3 available)
    • macOS (desktop)  • macos      • darwin-x64     • Mac OS X 10.15.7 19H2 darwin-x64
    • Web Server (web) • web-server • web-javascript • Flutter Tools
    • Chrome (web)     • chrome     • web-javascript • Google Chrome 86.0.4240.111

! Doctor found issues in 1 category.
@Piinks Piinks changed the title [web] Missing scrollbars Persistent Scrollbar Visibility Oct 22, 2020
@rbozan
Copy link

@rbozan rbozan commented Oct 22, 2020

Hey @theacodes It looks like the Scrollbar.isAlwaysShown feature reached stable in version 1.17. Does this feature meet the need you described above? I have tried this on Mac, Web, and mobile, and I think it achieves the effect you described.

class _MyHomePageState extends State<MyHomePage> {
  final ScrollController scrollController = ScrollController();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Scrollbar(
        isAlwaysShown: true,
        controller: scrollController,
        child: ListView.builder(
          controller: scrollController,
          itemCount: 200,
          itemBuilder: (context, index) => ListTile(title: Text("Item= ${index + 1}"),),),
      )
    );
  }
}

flutter doctor -v

[✓] Flutter (Channel master, 1.24.0-2.0.pre.111, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-US)
    • Flutter version 1.24.0-2.0.pre.111 at /Users/katelovett/github/flutter
    • Framework revision fe189baf34 (14 hours ago), 2020-10-21 22:25:53 -0400
    • Engine revision f459a86610
    • Dart version 2.11.0 (build 2.11.0-242.0.dev)

[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/katelovett/Library/Android/sdk
    ✗ Flutter requires Android SDK 29 and the Android BuildTools 28.0.3
      To update the Android SDK visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions.
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C505
    • CocoaPods version 1.9.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 48.1.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.49.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.15.1

[✓] Connected device (3 available)
    • macOS (desktop)  • macos      • darwin-x64     • Mac OS X 10.15.7 19H2 darwin-x64
    • Web Server (web) • web-server • web-javascript • Flutter Tools
    • Chrome (web)     • chrome     • web-javascript • Google Chrome 86.0.4240.111

! Doctor found issues in 1 category.

I am not the mentioned user, but I would like to have the normal scrollbar on web. Things like iOS Safari not scrolling to the top when you press the status bar, or accessibility issues like middle mouse button not functioning (haven’t tried it but I assume it does not work), also the scrollbar arrows where you can press a few times to scroll down and a setting in browsers to have smooth scrolling enabled or disabled are all the things that don’t work with isAlwaysShown.

@Piinks
Copy link
Contributor

@Piinks Piinks commented Oct 22, 2020

Hi @rbozan, this issue is focused on scrollbar visibility.
For interactive scrollbar support, see #31753
For middle mouse button support, you can follow #66537
If there are feature requests that you would like to see that aren't covered by an already open issue, feel free to file one so we can start working on finding a solution. Thanks! :)

@Piinks
Copy link
Contributor

@Piinks Piinks commented Oct 22, 2020

Another clarifying question - is this a request for always visible scrollbars by default for web and desktop applications? Like how we create the GlowingOverscrollIndicator by default in scroll views?
I have been triaging scrollbar issues this morning and I get the sense this is the full feature expectation.
Also related to: #36412

@Piinks Piinks changed the title Persistent Scrollbar Visibility Scrollbars should be always visible and instantiated by default on web and desktop Oct 22, 2020
@jlubeck
Copy link
Contributor

@jlubeck jlubeck commented Oct 22, 2020

Yes! I think on web and desktop they should be visible by default (when needed). Of course with option to hide

@theRealBitcoinClub
Copy link

@theRealBitcoinClub theRealBitcoinClub commented Nov 3, 2020

I am also missing the scrollbar as a default for web

@Sun3
Copy link

@Sun3 Sun3 commented Nov 19, 2020

For the web version the scrollbar should always be visible if the content does not fit in the current window/page in the browser.

I am really looking forward to this features, since users will not know how to scroll down on a web page when the scrollbars are not visible.

Thank you.

@Piinks Piinks mentioned this issue Nov 19, 2020
4 of 5 tasks complete
@Piinks
Copy link
Contributor

@Piinks Piinks commented Nov 19, 2020

Consolidating into #70866

@Piinks Piinks closed this Nov 19, 2020
@Piinks
Copy link
Contributor

@Piinks Piinks commented Jan 14, 2021

Re-opening again as an individual issue, see #70866 (comment) for latest

@Piinks Piinks reopened this Jan 14, 2021
@Macacoazul01
Copy link

@Macacoazul01 Macacoazul01 commented Jan 19, 2021

it will be nice to have a new documentation showing how to use the reworked scrollbar on flutter web/desktop after the update launches

@ganeshrvel
Copy link

@ganeshrvel ganeshrvel commented Jan 20, 2021

The app fails while trying to drag the Scrollbar when used with SliverList.

Code:

  Scrollbar(
      controller: _scrollController,
      child: CustomScrollView(
        controller: _scrollController,
        physics: const ScrollPhysics(),
        slivers: <Widget>[
          SliverList(
            delegate: SliverChildBuilderDelegate((BuildContext context, int index) {
              if (index >= itemLength) {
                return null;
              }

              return Container( width: 20);
            }),
          ),
        ],
      ),
    );

Screen recordings:

  1. https://drive.google.com/file/d/14xabgQXPmU_MBA4APOIfrnGfwvBXfPlq/view?usp=sharing
  2. https://drive.google.com/file/d/1PAnfumdzqZt5L4wIfLCLRgpEXe8XzRd0/view?usp=sharing
  3. https://drive.google.com/file/d/1BOKPk3K47d5oogI7GYMNpB3lsjOfSrhM/view?usp=sharing

My observation:

  1. Scrolling using trackpad doesn't break the app
  2. Drag and scroll results in app crash.
  3. I was able to pull the scrollbar out of the app window a couple of times (the app crashes soon after).
  4. For a list with a lot of rows the scroll bar doesn't show up until we reach the bottom (the app crashes soon after dragging the scrollbar)

Error:

flutter: �[38;5;196m│ �[0m�[39m�[48;5;196m'package:flutter/src/rendering/viewport.dart': Failed assertion: line 1522 pos 12: 'correctedOffset.isFinite': is not true.�[0m�[49m
flutter: �[38;5;196m├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄�[0m
flutter: �[38;5;196m│ #0   _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
flutter: �[38;5;196m│ #1   _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
flutter: �[38;5;196m│ #2   RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1522:12)
flutter: �[38;5;196m│ #3   RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1479:20)
flutter: �[38;5;196m│ #4   RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1634:7)
flutter: �[38;5;196m│ #5   PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:884:18)
flutter: �[38;5;196m│ #6   RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:453:19)
flutter: �[38;5;196m│ #7   WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:870:13)
flutter: �[38;5;196m

flutter --version

Flutter 1.26.0-2.0.pre.419 • channel master • https://github.com/flutter/flutter.git
Framework • revision 913d5933c1 (89 minutes ago) • 2021-01-19 22:34:03 -0800
Engine • revision b58dbc88fc
Tools • Dart 2.12.0 (build 2.12.0-240.0.dev)

flutter doctor

[✓] Flutter (Channel master, 1.26.0-2.0.pre.419, on macOS 11.1 20C69
    darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version
    30.0.3)
[✓] Xcode - develop for iOS and macOS
@Piinks
Copy link
Contributor

@Piinks Piinks commented Jan 20, 2021

@ganeshrvel can you please file a new issue with a reproduction of your issue? This issue for for a separate feature. Thank you!

@ganeshrvel
Copy link

@ganeshrvel ganeshrvel commented Jan 21, 2021

@Piinks created: #74404

@arualana
Copy link

@arualana arualana commented Jan 23, 2021

Yes! I think on web and desktop they should be visible by default (when needed). Of course with option to hide

If it when needed, then it is not always visible

@Leffe108
Copy link

@Leffe108 Leffe108 commented Jan 24, 2021

On some platforms (Windows) there is a system preference for if scrollbars should auto-hide or not.

I understand we are not having scrollbars at all and respecting settings like this one is the cherry on top. But just pointing out that this system setting exist. Similar to how an app preferable respect system dark mode setting.

bild

@Piinks
Copy link
Contributor

@Piinks Piinks commented Feb 4, 2021

I have a proposed solution in #75354
Although I am not sure this is the best idea to implement so I'm requesting any feedback or input. :)

Here are my concerns with auto-generated Scrollbars:

  • users will be annoyed by Scrollbars showing up where they are not wanted
  • users that are already using Scrollbars on desktop/web will be broken by duped Scrollbars (if the user implements a Scrollbar, ti will be duped by the auto-scrollbar)
  • users implementing or extending ScrollBehavior.buildViewportChrome will be broken
  • creating scrollbars on mobile will require the user to add special handling when their app in on web/desktop, lest be affected by the duped scrollbar exception mentioned above
    • or they could turn off autoScrollbars all together and have no issue - which I think kind of nullifies the point of this feature.

Also, I don't think we can automatically detect a Scrollbar created by the user. They can be placed anywhere in the tree, and even if we could track them all down, we would need to distinguish which were made automatically and which were user generated.
Also, there is already a pattern of use where the Scrollbar listens to more than one Scrollable. I've seen this most often with 2D scrolling.

Please see the change (#75354) for more context. All input is welcome while we try to decide the best way to proceed here. :)

@Leffe108
Copy link

@Leffe108 Leffe108 commented Feb 6, 2021

In response to request for comments.

Your values state:

Our first priority is to our developer's user, the end user. Our second priority is to our user, the developer.

On desktop and desktop web end users of software use a vairity of input devices. A mouse with a scroll wheel is common, but it cannot be expected that every user has that. For example I use a trackball which do not have a scroll wheel, instead I use the scroll bars and hold a button and scroll by rolling the ball which has infinite movement by design. Other users may be using other devices for accessibility like voice control with eye mouse or a grid mouse.

Basically, there are a vast vairity of users out there and not every developer is able to understand or anticipate the impact of not adding a scroll bar to their app. So the framework need to be accessible by default in order for most apps to have good accessibility. Then of course I'm not against flags to allow a developer to hide scrollbars if their app is a digital signage app or other situation where they know the scrollbar is not desired. But I think developers should need to opt-out of it. Which could be as simple as a property with a default value.

@Piinks Piinks mentioned this issue Feb 9, 2021
0 of 8 tasks complete
@Macacoazul01
Copy link

@Macacoazul01 Macacoazul01 commented Feb 10, 2021

@Piinks is there any expected date to your pr being implemented on any of the branchs?

@Sun3
Copy link

@Sun3 Sun3 commented Feb 15, 2021

I am also looking for an update, especially for Flutter Web. I have a production app that really needs this feature.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.