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

Fix: Momentum scrolling continues despite press and hold in list view #196

Merged
merged 3 commits into from
Jul 21, 2024

Conversation

fujidaiti
Copy link
Owner

@fujidaiti fujidaiti commented Jul 13, 2024

Fixes / Closes (optional)

Fixes #190.

Description

This PR fixes an incorrect use of the ScrollActivity.shouldIgnorePointer flag that has caused the issue.

Previously, DragScrollDrivenSheetActivity used to start a SheetContentBallisticScrollActivity with shouldIgnorePointer set to false when a drag gesture ended. However, it should actually be true except in a special case. This is because setting ScrollActivity.shouldIgnorePointer to true means that clickable items in the scroll view cannot receive pointer events while performing that activity, and the scroll view may receive them instead. So if the flag is set to false during a ballistic scroll animation and there are any clickable items in the scroll view, the scroll view may not be able to receive the pointer events, resulting in the ballistic scroll animation not stopping in response to user gestures.

After this PR is merged, SheetContentBallisticScrollActivity will be started with the same value of shouldIgnorePointer as the previous ScrollActivity. Note that we can't use a hardcoded value of true here, as it may need to be false in a special case where the pointer device kind is PointerDeviceKind.trackpad.

Summary (check all that apply)

  • Modified / added code
  • Modified / added tests
  • Modified / added examples
  • Modified / added others (pubspec.yaml, workflows, etc...)
  • Updated README
  • Contains breaking changes
    • Created / updated migration guide
  • Incremented version number
    • Updated CHANGELOG

@fujidaiti fujidaiti self-assigned this Jul 13, 2024
@fujidaiti fujidaiti changed the title Fix: Momentum scrolling continues despite press and hold in list view if items are clickable Fix: Momentum scrolling continues despite press and hold in list view Jul 13, 2024
@fujidaiti fujidaiti force-pushed the fix-scrollable-ignore-tap branch 3 times, most recently from 21ab604 to 8d1b0a5 Compare July 20, 2024 03:50
@fujidaiti fujidaiti marked this pull request as ready for review July 20, 2024 05:51
@fujidaiti fujidaiti force-pushed the fix-scrollable-ignore-tap branch from 8d1b0a5 to 00539af Compare July 21, 2024 13:04
@fujidaiti fujidaiti enabled auto-merge (squash) July 21, 2024 13:05
@fujidaiti fujidaiti merged commit b0b2e87 into main Jul 21, 2024
7 checks passed
@fujidaiti fujidaiti deleted the fix-scrollable-ignore-tap branch July 21, 2024 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Momentum scrolling continues despite press and hold in list view if items are clickable
1 participant