[152588] Fix Scrollable being too eager to respond to pointer signals#183302
Conversation
There was a problem hiding this comment.
Code Review
This pull request modifies the Scrollable widget's handling of pointer signals. The changes remove explicit calls to event.respond(allowPlatformDefault: true), which previously indicated that a pointer event was not handled. This responsibility is now fully delegated to the PointerSignalResolver. A new regression test is included to verify the corrected behavior in a nested scrollable scenario, ensuring events are correctly propagated and handled within the widget hierarchy.
Note: Security Review is unavailable for this PR.
Piinks
left a comment
There was a problem hiding this comment.
This LGTM, thank you again!
|
Hey @O-Hannonen it looks like this ran into an issue with testing, can you rebase with the tip of tree? |
|
Nevermind, the issue was that I did |
…o-pointer-signals
|
|
||
| import 'package:flutter/foundation.dart'; | ||
| import 'package:flutter/gestures.dart'; | ||
| import 'package:flutter/material.dart'; |
There was a problem hiding this comment.
We're actively trying to remove dependencies on material from widgets as we are preparing to remove material from the framework. Can you update the test to not depend on material and remove this import?
This PR
Some history and reasoning
Root cause
The bug was introduced in PR #145500, which fixed issue #139263 by ensuring that the Web engine knows when a scroll event is not handled by Flutter. This allows the browser to perform default actions like page scrolling or back/forward navigation. Without this, Flutter might "swallow" events it doesn't use, leading to a "dead" feel on the web.
Why reverting is safe and won't regress Issue #139263
Reverting the manual
respond(true)calls in Scrollable is safe becausePointerSignalResolver(the centralized mediator for these events) already has the logic to notify the engine. More specifically,PointerSignalResolver.resolvecallsevent.respond(allowPlatformDefault: true)if and only if no widget in the hit-test tree registered interest in the event.Moving this responsibility back to the
PointerSignalResolverensures that:respond(true)is not called.respond(true)at the end of the dispatch cycle.The current bug exists because
Scrollablewas trying to be too helpful by callingrespond(true)based only on its local state, which overrides any handling done by other widgets in the hierarchy.Testing and verifying
A new regression test was created that highlight how the respond calls should work in nested
Scrollableelements.The "fallback" nature of
PointerSignalResolveris alreadypointer_signal_resolver.dart:pointer_signal_resolver_test.dart:Pre-launch Checklist
///).