Skip to content

fix(client): fire GestureDetector.on_tap_move events - #6982

Merged
FeodorFitsner merged 5 commits into
flet-dev:flet-1.1.0from
inchang-ing:fix/gesture-tap-move-event
Oct 18, 2026
Merged

FeodorFitsner merged 5 commits into
flet-dev:flet-1.1.0from
inchang-ing:fix/gesture-tap-move-event

Conversation

@inchang-ing

@inchang-ing inchang-ing commented Oct 18, 2026 •

Copy link
Copy Markdown

Summary

Fixes #6961: GestureDetector.on_tap_move now reaches its Python handler.

Flutter's GestureDetector does not forward onTapMove to its TapGestureRecognizer. When tap moves are subscribed, Flet routes all primary, secondary, and tertiary tap callbacks through one recognizer registered by RawGestureDetector. This preserves a single functioning accessibility tap action when secondary or tertiary handlers are also subscribed.

The recognizer's supportedDevices is refreshed on every rebuild so changes to allowed_devices take effect. Media query gesture settings and exclude_from_semantics are preserved. The raw wrapper stays mounted when tap-move subscriptions change, preserving content state and focus. When tap moves are not subscribed, callbacks continue to use Flutter's GestureDetector.

Includes a changelog entry under 1.1.0. Targets flet-1.1.0.

Validation

On Flutter 3.47.7, as pinned by the target release:

  • 23 gesture-detector widget tests pass: tap moves, move-only subscriptions, cancellation, device-filter updates, primary tap semantics with secondary/tertiary handlers, double taps, long presses, secondary/tertiary mouse taps and cancellation, and focused content surviving subscription changes in both directions.
  • Existing list_tile_test.dart and control_test.dart suites pass (41 tests total across the three suites).
  • Static analysis of the changed implementation and tests reports no issues.

Summary by Sourcery

Fix tap-move event delivery in gesture detectors without disrupting existing tap, accessibility, or child-state behavior.

Bug Fixes:

  • Fix GestureDetector.on_tap_move events so they reach Python handlers while preserving primary, secondary, and tertiary tap behavior and accessibility semantics.
  • Ensure gesture device filters update correctly when allowed_devices changes.

Enhancements:

  • Preserve gesture settings and child widget state when switching tap-move handling.

Tests:

  • Add comprehensive gesture detector coverage for tap moves, cancellation, device filters, accessibility actions, competing gestures, mouse buttons, and state preservation.

…izer

Flutter's GestureDetector never forwards its onTapMove parameter to the
TapGestureRecognizer it creates: the parameter is missing both from the
recognizer registration condition and from the recognizer configuration,
so GestureDetector.onTapMove is dead code and Flet's
GestureDetector.on_tap_move never fired (flet-dev#6961).

When on_tap_move is subscribed, the whole primary tap family
(on_tap_down/on_tap_up/on_tap/on_tap_cancel/on_tap_move) is now wired
into a TapGestureRecognizer registered by a RawGestureDetector wrapping
the content, so exactly one tap recognizer competes in the gesture arena
and tap/tap_down/tap_up/tap_cancel behavior is preserved.

Fixes flet-dev#6961
@CLAassistant

CLAassistant commented Oct 18, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@FeodorFitsner
FeodorFitsner changed the base branch from main to flet-1.1.0 October 18, 2026 18:02
@FeodorFitsner

Copy link
Copy Markdown
Contributor

Pushed fixes for the two review findings in 8d2cb43:

  • Refresh supportedDevices on rebuild so changes to allowed_devices take effect.
  • Route primary, secondary, and tertiary tap callbacks through the same recognizer when tap moves are subscribed, preserving one functioning accessibility tap target.

Added regression tests and moved the changelog entry to 1.1.0. All 39 tests across gesture_detector_test.dart, list_tile_test.dart, and control_test.dart pass on Flutter 3.47.7; static analysis of the changed implementation and tests is clean.

The PR now targets flet-1.1.0; its diff contains only the gesture detector, its tests, and the root changelog (3 files).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Toggling the tap-move subscription recreates the content subtree, losing local widget state.

1 open issue
What changed in this PR

Fixes #6961 by routing tap-move events through a raw tap recognizer so they reach Python handlers.

Changes:

  • Routes tap callbacks through one recognizer when tap moves are subscribed.
  • Adds regression tests for gestures, accessibility, and device filtering.
  • Documents the fix in the 1.1.0 changelog.
File Description
packages/​flet/​test/​widgets/​gesture_detector_test.dart Adds gesture and accessibility regression tests.
packages/​flet/​lib/​src/​controls/​gesture_detector.dart Implements conditional raw tap recognition.
CHANGELOG.md Records the tap-move fix.

Review effort: Balanced

Comment thread packages/flet/lib/src/controls/gesture_detector.dart Outdated
@FeodorFitsner
FeodorFitsner merged commit 18039d5 into flet-dev:flet-1.1.0 Oct 18, 2026
2 checks passed
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.

bug: GestureDetector on_tap_move doesnt seem to ever trigger

4 participants