Repository navigation
Closed
Closed
Copy link
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: gesturesflutter/packages/flutter/gestures repository.flutter/packages/flutter/gestures repository.f: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.24Found to occur in 3.24Found to occur in 3.24frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesplatform-webWeb applications specificallyWeb applications specificallyteam-webOwned by Web platform teamOwned by Web platform teamtriaged-webTriaged by Web platform teamTriaged by Web platform teamworkaround availableThere is a workaround available to overcome the issueThere is a workaround available to overcome the issue
Description
If you navigate to this page from somewhere else and try to scroll the carousel view BACK you have to slide perfectly horizontally. Any deviation and you start the mac "back" action in the browser.
Flutter 3.24.0-1.0.pre.214
352322311-6cdc179e-ed34-4af7-a55b-ba127f8602ee.mov
I thought it was related to #143276 (comment) – but I'm being told...not
Reacted by Markus Rubey, James O'Leary, Daniel Enqvist, nick9822, Jorge Luis, ShadowBoxingSkills, Aravind, Michael Rublev, m-j-g, Kostia Sokolovskyi and 40 more
Reacted by ShadowBoxingSkills, Aravind, m-j-g, Kostia Sokolovskyi, ObviouslyRichB, Will Roxby, obv-andre, MattisBrizard, Kris Pypen, Ryan Richard and 4 more
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: gesturesflutter/packages/flutter/gestures repository.flutter/packages/flutter/gestures repository.f: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.24Found to occur in 3.24Found to occur in 3.24frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesplatform-webWeb applications specificallyWeb applications specificallyteam-webOwned by Web platform teamOwned by Web platform teamtriaged-webTriaged by Web platform teamTriaged by Web platform teamworkaround availableThere is a workaround available to overcome the issueThere is a workaround available to overcome the issue
Activity
kevmoo commentedon Jul 30, 2024
CC @moffatman @Piinks
[-]`CarouselView`[/-][+]`CarouselView` scroll "back" on web causes browser back action (unless perfectly horizontal)[/+]moffatman commentedon Jul 30, 2024
Yeah idk. Maybe we need some e.preventDefault() somewhere
kevmoo commentedon Jul 31, 2024
Weird that it acts FINE on native, BTW. I tried on Mac desktop.
Piinks commentedon Jul 31, 2024
Why is it weird? Desktop apps do not have a back gesture (which is conflicting with the scroll gesture) like web does AFAIK.
35 remaining items
AlexDochioiu commentedon Mar 21, 2025
+1 . Issue still persists in flutter 3.29.2.
Also, this seems to be the best fix (trade-off) for now:
Michkwetzel commentedon May 21, 2025
Some Insight
This strongly suggests a gesture ownership conflict or the if there is navigation history the browser overlooks the flutter widget.
Possible Cause
The issue appears to be that Flutter initially detects and begins processing the horizontal gesture (as evidenced by the slight movement), but doesn't properly signal to the browser that it should override the default navigation behavior. The browser then "steals" control of the gesture from Flutter.
This explains why the right-then-left pattern works: once Flutter establishes firm control of the gesture sequence by scrolling in one direction, it maintains that control when the direction changes.
Proposed Solution Concept
Flutter code needs to:
Maybe I am completely wrong but this makes sense to me and hope this will provide further clarity on the issue. For now
works
NicolaVerbeeck commentedon Jun 26, 2025
Is there anyway around this issue in the scenario that flutter is placed embedded in another top level page (especially if flutter is running in an iframe). Putting these styles on the iframe does not solve the behaviour.
HeinrichJanzing commentedon Aug 12, 2025
I think this problem is related to the nesting of a horizontal scroll view in a vertical scroll view, which seems to be the case in the original Carrousel example, too.
Looking at the implementation of
ScrollableState._receivedPointerSignal:On both marked lines, we allow default platform behavior if the scroll event would have no effect for us. Imagine a horizontal scroll view nested in a vertical one. A horizontal touchpad gesture is performed, resulting in a
PointerScrollEventwith ascrollDelta.dx != 0 && scrollDelta.dy == 0. Both scroll views will receive the pointer signal. The horizontal one may deem it relevant and register with thepointerSignalResolver. The vertical one will deem it irrelevant and callevent.respond(allowPlatformDefault: true), resulting in the undesired triggering of backnavigation.It seems to me no single widget should call
event.respond(allowPlatformDefault: true)in aPointerSignalEventlistener, since the event could be relevant to another widget that is also receiving it. Based on the implementation ofPointerSignalResolver.resolve, it seems to me that this explicitevent.respondcould be unnecessary. It is the default behavior if no one has claimed thePointerScrollEvent:If I just remove both marked lines from
scrollable.dartthe problem seems to be solved, but I'm sure they were there for some reason. @ditman since you introduced this functionality: any input on the reason for the additional explicit calls toevent.respondin ScrollableState._receivedPointerSignal?lsimunec commentedon Sep 18, 2025
Reusable widget if someone needs to disable the web swipe back/forward gesture for certain widget/region.
hover_disable_swipe_widget.darthover_no_swipe_stub.darthover_no_swipe_web.dartO-Hannonen commentedon Mar 6, 2026
Did some pretty thorough investigations and came to the same conclusion as @HeinrichJanzing. I really could not find any reason why
Scrollableshould manually signalresolve(true)from its local state, so I deemed it as oversight in the original PR #145500. @ditman feel free to correct if this assumption is wrong 😅Wrote down quite detailed reasoning to the PR, but a small recap here too:
Reverting the changes from PR #145500 that added these manual respond calls will not regress the original issue (#139263). The
PointerSignalResolver.resolvemethod already callsevent.respond(allowPlatformDefault: true)when no callback is registered. By removing the eager calls inScrollable, we allow the resolver to wait until the entire hit-test path is processed, ensuring that if any widget (like a horizontal carousel) handles the event, the engine is correctly notified that the framework has claimed the gesture, thus preventing the browser's default navigation behavior.[152588] Fix Scrollable being too eager to respond to pointer signals (
ditman commentedon Mar 20, 2026
Oh my! I haven't worked in this for a very long time, so my opinion doesn't matter much, but I'm sure your fix is appropriate! Thanks for fixing this! Looking forward to testing carousels on the web again!
[152588] Fix Scrollable being too eager to respond to pointer signals (
github-actions commentedon Apr 3, 2026
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 -vand a minimal reproduction of the issue.[152588] Fix Scrollable being too eager to respond to pointer signals (