Skip to content

feat(canvas): add a setting to turn off auto-focus when clicking blocks - #6685

Merged
waleedlatif1 merged 3 commits into
stagingfrom
feat/disable-canvas-autofocus
Aug 14, 2026
Merged

feat(canvas): add a setting to turn off auto-focus when clicking blocks#6685
waleedlatif1 merged 3 commits into
stagingfrom
feat/disable-canvas-autofocus

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Adds an Auto-focus on click preference under Settings → General. Clicking a block animates the camera to center it, and it zooms in far enough that you lose sight of the rest of the workflow. Defaults to on, so nothing changes unless you turn it off.
  • Gates only the focusBlockInView call in handleNodeClick. userFocusedWorkflowIdRef is still marked on every plain node click — it's what stops <ReactFlow onInit> from running fitView over your framing, so skipping it would have blown away the framing of exactly the people who turned the setting off to keep it.
  • New auto_focus_on_click column (additive, non-null default true), threaded through the existing user-settings contract, query, and React Query hook. No new API surface — the PATCH route already spreads the validated body into the upsert.
  • Re-records the auto-connect and canvas-error-notification tooltip previews and adds one for the new setting. All three re-encoded to match the existing assets (h264 / yuv420p / 60fps / faststart); the error-notification clip had 2.45s of empty lead before the toast appeared, which is now trimmed.

Scope worth a second opinion

focusBlockInView has three callers. This gates the click path only. Deliberately left alone:

  • Arrow-key navigation — without the camera following, selection lands on an off-screen block with no feedback.
  • Block creation — a new block can land outside the viewport; not moving the camera means it appears nowhere.
  • Note expand (note-block.tsx) — fires on the second click, pans at the current zoom rather than zooming, and exists so an expanded note isn't half off-screen.

Each of those is unchanged behavior, so this PR can't regress them. Happy to widen the setting to cover them if reviewers disagree.

Type of Change

  • New feature

Testing

Tested manually. type-check, check:api-validation, and check:migrations pass; canvas suite green (349 tests). Tooltip clips were rendered at the 240px width Tooltip.Preview actually uses and inspected frame by frame.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Clicking a block animates the camera to center it, which zooms in far
enough that you lose sight of the rest of the workflow. Add an
"Auto-focus on click" preference (on by default, so existing behavior is
unchanged) that keeps the camera still on click.

Also re-record the auto-connect and canvas-error-notification tooltip
previews and re-encode all three at a smaller size.
…tooltips

Gating the whole click branch on the setting also skipped the
userFocusedWorkflowIdRef write, which is what stops <ReactFlow onInit>
from running fitView over the user's framing. That would have blown away
the framing of exactly the users who turned auto-focus off to keep it.
Mark the workflow as user-framed on any plain node click and gate only
the camera move.

Crop the auto-focus preview to the recording's viewport center so the
blocks are legible at the 240px width Tooltip.Preview renders at, and
trim the 2.45s of empty lead off the error-notification preview.
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 14, 2026 12:03am

Request Review

@cursor

cursor Bot commented Aug 13, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Additive setting with default-on behavior and a narrow change to canvas click handling; no auth or data-model risk beyond a standard settings column.

Overview
Adds an Auto-focus on click toggle under Settings → General (default on). When off, clicking a workflow block no longer runs focusBlockInView to pan/zoom the canvas to center it.

The preference is stored as auto_focus_on_click and wired through existing user-settings API, queries, and useAutoFocusOnClick. Plain node clicks still update userFocusedWorkflowIdRef so React Flow init does not fitView over the user’s chosen framing when auto-focus is disabled.

Arrow-key navigation, new-block placement, and note expand still move the camera as before; only the click path is gated.

Reviewed by Cursor Bugbot for commit 53681fb. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds a persisted, default-enabled preference that lets users disable camera auto-focus when clicking canvas blocks.

  • Adds the General Settings switch and tooltip preview.
  • Threads autoFocusOnClick through validation, querying, defaults, schema, and migration metadata.
  • Gates click-triggered canvas focusing while preserving focusing for keyboard navigation and block creation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/hooks/queries/general-settings.ts Adds the preference mapping and hook; the revised TSDoc accurately documents its click-only scope and intentional exclusions.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx Gates plain-click camera focusing with the new preference while preserving existing keyboard-navigation and block-creation behavior.
apps/sim/app/workspace/[workspaceId]/settings/components/general/general.tsx Adds the default-enabled General Settings switch and explanatory tooltip.
apps/sim/lib/api/contracts/user.ts Extends the user-settings response and update contracts with the boolean preference.
apps/sim/lib/users/queries.ts Includes the preference in default, selected, and normalized user settings.
packages/db/migrations/0290_settings_auto_focus_on_click.sql Adds the non-null preference column with a backward-compatible true default.
packages/db/schema.ts Adds the corresponding default-enabled boolean field to the settings schema.

Reviews (2): Last reviewed commit: "docs(canvas): correct useAutoFocusOnClic..." | Re-trigger Greptile

Comment thread apps/sim/hooks/queries/general-settings.ts
The TSDoc claimed the preference also gated arrow-key navigation, which
calls focusBlockInView without consulting it. State the click-only scope
and why arrow-key navigation and block creation are excluded.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 53681fb. Configure here.

@waleedlatif1
waleedlatif1 merged commit 264d4f3 into staging Aug 14, 2026
24 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/disable-canvas-autofocus branch August 14, 2026 00:05
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