fix(flow): disable panning/dragging when canvas=false#390
Conversation
…n canvas=false - Remove pan event handlers and grab cursor when canvas prop is false - Add FlowWithCodeBlockDemo to test page verifying CodeHighlighted works inside a Flow.Node
commit: |
Docs PreviewCommit: |
|
/bonk what say you? |
|
UnknownError: ProviderInitError |
|
@mattrothenberg Bonk workflow failed. Check the logs for details. View workflow run · To retry, trigger Bonk again. |
|
/bigbonk review code |
There was a problem hiding this comment.
Clean, minimal fix. The core change in diagram.tsx is correct — guarding the pan handlers and cursor with the canvas prop is the right approach and consistent with how the existing useEffect hooks already early-return when canvas is false.
One minor inconsistency in the test page, noted below.
Co-authored-by: stritt <stritt@users.noreply.github.com>
|
Review submitted. Here's a summary: Approved the PR with one minor suggestion. Core fix ( Demo + test page: The One nit: The new test section uses |
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
|
thanks for this! the underlying canvas=false fix still looks useful, but the branch now conflicts with the current flow implementation. this may be easiest to port onto current main with the tests, but feel free to rebase it if you have time and we can get it reviewed again. |

























































Fixes a bug where text inside a flow node is not selectable even when
canvasis set tofalsein the parent component (therefore disabling all dragging features).Changes
canvas={false}, pan event handlers (onPanStart,onPan,onPanEnd) are no longer attached to the motion wrapper, so dragging/panning is fully inertgrab/grabbingcursor anduserSelect: nonebody mutations are suppressed —canvas && canPan && !isPanningguards the cursor style, and the handlers that set body styles are never calledFlowWithCodeBlockDemoto the/tests/flowtest page: acanvas={false}flow where one node embeds aCodeHighlightedblock, verifying syntax highlighting works inside a flow node and that text selection is not blocked