Skip to content

fix(search): restore cmd+k autofocus on the search input - #6347

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/cmdk-autofocus-regression
Aug 6, 2026
Merged

fix(search): restore cmd+k autofocus on the search input#6347
waleedlatif1 merged 1 commit into
stagingfrom
fix/cmdk-autofocus-regression

Conversation

@waleedlatif1

@waleedlatif1waleedlatif1 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Cmd+K opened the search palette without focusing the input, so you had to click it before typing
  • Regressed in feat(browser, terminal): implement browser driver, password manager, terminal features #6196 (5ab5f2c7e): the dialog's visibility gate moved to visuallyOpen (open && nativeSurfaceReady), but the focus effect stayed on a separate focusReady gate that is just open off the desktop app
  • nativeSurfaceReady starts false and only flips inside a useLayoutEffect, so the focus effect ran in the commit where the panel still carried invisible.focus() on a visibility: hidden element is a silent no-op, and nothing re-focused it afterwards
  • Fix is one gate: focus off visuallyOpen, so it runs on the first commit where the panel is actually visible. Desktop (atomic browser panel occlusion) already waited for that same signal, so its behavior is unchanged

Type of Change

  • Bug fix

Testing

Typecheck and lint pass. Not yet verified in a running browser — needs a manual Cmd+K check before merge.

No unit test: the failure depends on visibility: hidden making an element unfocusable, which jsdom does not model (it applies no Tailwind CSS), so a test here would pass with or without the fix.

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)

@vercel

vercelBot commented Aug 6, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
docsSkippedSkippedAug 6, 2026 10:44pm

Request Review

@cursor

cursorBot commented Aug 6, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Small UI focus-timing fix in the search modal with no auth, data, or API changes.

Overview
Fixes Cmd+K opening the search palette without focusing the input (regression from splitting visibility on visuallyOpen while focus still gated on focusReady / open).

The focus useEffect now runs when visuallyOpen is true—the same signal used to drop invisible on the dialog—so .focus() happens after the surface is actually visible. The separate focusReady gate is removed. Desktop paths that already waited on visuallyOpen are unchanged.

Reviewed by Cursor Bugbot for commit 0556297. Configure here.

@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR restores Cmd+K autofocus by delaying the search-input focus effect until the dialog is visibly open.

  • Removes the separate platform-dependent focusReady gate.
  • Uses visuallyOpen for both the focus guard and effect dependency.
  • Documents why focusing while the dialog carries visibility: hidden is ineffective.

Confidence Score: 5/5

The PR appears safe to merge, with the autofocus effect now aligned to the dialog’s visible lifecycle.

The focus effect waits for visuallyOpen, avoids attempting focus while the input is hidden, and remains guarded during close and native-surface preparation states.

Important Files Changed

FilenameOverview
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/search-modal/search-modal.tsxAligns input focus with the modal’s visible state, without introducing an actionable lifecycle or repository-rule issue.

Reviews (1): Last reviewed commit: "fix(search): restore cmd+k autofocus on ..." | Re-trigger Greptile

@waleedlatif1
waleedlatif1 merged commit 85a4cb0 into stagingAug 6, 2026
5 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/cmdk-autofocus-regression branch August 6, 2026 22:52
Sign up for freeto 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

@waleedlatif1