Skip to content

Conversation

@TahaTesser
Copy link
Member

@TahaTesser TahaTesser commented Jul 22, 2022

fixes #107765

This PR fixes the issue where Scrollbar can be dragged above or below the viewport on the desktop.

All the desktop platforms seem to have the same scroll behavior, (Scrollbar can only be dragged the dragging parallel to the cross axis).
#107765 has reproduced the issue Linux and Windows compared it with native applications and I have tested native macOS applications.

Bug

scrollbar_bug.mov

Fix

scrollbar_fixed.mov

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. labels Jul 22, 2022
@TahaTesser TahaTesser requested a review from Piinks July 22, 2022 14:47
switch (position.axisDirection) {
case AxisDirection.up:
primaryDelta = _dragScrollbarAxisOffset!.dy - updatedOffset.dy;
primaryDelta = clampDouble(_dragScrollbarAxisOffset!.dy, 0, position.viewportDimension) - updatedOffset.dy;
Copy link
Member

@werainkhatri werainkhatri Jul 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think clamping is the correct or expected behavior, especially in MacOS (haven't tested in Windows or Linux). As per the video below, which is Wikipedia open in Safari on MacOS Monoterey 12.4, looks like the last position where the mouse was "clicking" just before the scrollbar was about to overflow is saved and scrolling can resume only when the cursor crosses the that position.

Screen.Recording.2022-07-23.at.4.04.08.PM.mov

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I will look into it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macOS with trackpad behaves differently

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks same to me, mouse or touchpad. do you mind sharing a video?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My colleague @huycozy tested this on all three platforms (Windows, macOS, and Linux) and concluded it's the same behavior on the other two platforms as @werainkhatri pointed out, thanks!

Based on these new findings, I will figure out the new scrolling scrollbar behavior.

@TahaTesser
Copy link
Member Author

Currently, updated offset and drag offset are not sufficient to distinguish drag from a specific location.
I have other priorities before my vacation but I will come to this after.

@TahaTesser TahaTesser closed this Aug 1, 2022
@TahaTesser TahaTesser deleted the fix_scrollbar_drag_desktop branch August 1, 2022 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ScrollBar moves with an offset if cursor leaves flutter application.

3 participants