Skip to content

fix(mobile): make interactive content inside nodes work under touch#1

Open
JibayMcs wants to merge 2 commits into
nick-0:fix/mobile-dragfrom
JibayMcs:fix/mobile-interactive-content
Open

fix(mobile): make interactive content inside nodes work under touch#1
JibayMcs wants to merge 2 commits into
nick-0:fix/mobile-dragfrom
JibayMcs:fix/mobile-interactive-content

Conversation

@JibayMcs

@JibayMcs JibayMcs commented Jun 5, 2026

Copy link
Copy Markdown

Builds on this PR's mobile node drag. For a node whose custom widget embeds interactive content (a scrollable, text fields), on touch/Android:

  • scrolling a ListView inside a node no longer drags the node;
  • long-press / selecting text in a TextField inside a node now works (the InteractiveViewer's always-present ScaleGestureRecognizer no longer steals the long-press, and a tap no longer steals focus from the field).

Changes: lib/src/editor/element_scope.dart (skip touch node-drag capture over a scrollable or editable child), node_flow_editor.dart (swap InteractiveViewer for a plain Transform while editing so descendant gestures win; focus-aware) and node_flow_editor_hit_testing.dart (don't steal canvas focus on a tap while a field is focused).

JibayMcs added 2 commits June 6, 2026 01:47
Builds on this PR's mobile node drag. For a node whose custom widget embeds
interactive content (a scrollable, text fields), on touch/Android:
- scrolling a ListView inside a node no longer drags the node;
- long-press / selecting text in a TextField inside a node now works (the
  InteractiveViewer's always-present ScaleGestureRecognizer no longer steals the
  long-press, and a tap no longer steals focus from the field).

Changes: lib/src/editor/element_scope.dart (skip touch node-drag capture over a
scrollable or editable child), node_flow_editor.dart (swap InteractiveViewer for
a plain Transform while editing so descendant gestures win; focus-aware) and
node_flow_editor_hit_testing.dart (don't steal canvas focus on a tap while a
field is focused).
The canvas swaps the InteractiveViewer for a plain Transform while the canvas is
locked or a node's text field is focused. The whole canvas is built inside a
LayoutBuilder, which owns a build scope flushed during layout, so the swap
reparents the GlobalKey canvas content inside the layout pass. When a mouse-hover
Tooltip OverlayPortal is active, reactivating it mid-layout throws
"_RenderLayoutBuilder was mutated in performLayout" — crashing on desktop (never
on touch, which has no hover).

The swap is a touch-only workaround (long-press text selection plus keeping the
keyboard up). Gate it to touch platforms so desktop keeps the InteractiveViewer
with pan/zoom gated by the lock state — no reparent, no crash. The touch swap is
also now driven by a mobx observable instead of setState, with keyboard
visibility cached in didChangeDependencies.
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.

1 participant