From 446be6933f4ecc207eed94db361ff40a88c3964f Mon Sep 17 00:00:00 2001 From: Dara Adedeji <76637177+SunkenInTime@users.noreply.github.com> Date: Tue, 13 Oct 2026 13:37:33 -0400 Subject: [PATCH] fix(web): Cmd+Enter creates the new project while an option is highlighted (#18901) Co-authored-by: Claude Opus 5.5 --- apps/web/src/components/CommandPalette.tsx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx index 7280f7457baa222f597fde97742df11b0321901a..6596e451e3fc60f92bb01523b613f1d34a4f978d 100644 --- a/apps/web/src/components/CommandPalette.tsx +++ b/apps/web/src/components/CommandPalette.tsx @@ -3072,6 +3072,10 @@ function OpenCommandPaletteDialog(props: { ? "Create & Add" : "Add"; const addShortcutLabel = hasHighlightedBrowseItem ? `${submitModifierLabel} Enter` : "Enter"; + const hasHighlightedNewProjectItem = newProjectFlow !== null && highlightedItemValue !== null; + const createShortcutLabel = hasHighlightedNewProjectItem + ? `${submitModifierLabel} Enter` + : "Enter"; const remoteProjectButtonLabel = addProjectCloneFlow ? addProjectCloneFlow.source === "url" ? "Continue" @@ -3165,15 +3169,17 @@ function OpenCommandPaletteDialog(props: { } // Enter creates the project unless an item below the name is - // highlighted, in which case it runs that item. + // highlighted, in which case it runs that item. Mod+Enter always creates. if ( newProjectFlow !== null && event.key === "Enter" && - highlightedItemValue === null && + (!hasHighlightedNewProjectItem || isPrimaryModifierPressed(event)) && // Enter that confirms an IME composition is part of typing the name. !event.nativeEvent.isComposing && event.keyCode !== 229 ) { + // Base UI would otherwise also click the highlighted row. + (event as typeof event & { preventBaseUIHandler?: () => void }).preventBaseUIHandler?.(); event.preventDefault(); void submitNewProject(); return; @@ -3383,7 +3389,7 @@ function OpenCommandPaletteDialog(props: { size="xs" tabIndex={-1} className="absolute inset-e-2.5 top-1/2 -translate-y-1/2" - aria-label="Create (Enter)" + aria-label={`Create (${createShortcutLabel})`} disabled={!canSubmitNewProject} onMouseDown={(event) => { event.preventDefault(); @@ -3396,10 +3402,10 @@ function OpenCommandPaletteDialog(props: { > {isCreatingNewProject ? "Creating" : "Create"} - Enter + {createShortcutLabel} - Create (Enter) + {`Create (${createShortcutLabel})`} ) : addProjectCloneFlow?.step === "repository" ? ( @@ -3512,8 +3518,9 @@ function OpenCommandPaletteDialog(props: { inputProps={{ // The submit button is absolutely positioned over the field, so the // inner input must reserve enough room for the full action label. - className: - addProjectCloneFlow?.step === "repository" || newProjectFlow !== null + className: hasHighlightedNewProjectItem + ? "*:data-[slot=autocomplete-input]:pe-38!" + : addProjectCloneFlow?.step === "repository" || newProjectFlow !== null ? "*:data-[slot=autocomplete-input]:pe-32!" : isBrowsing ? browseInputEndPaddingClass({ -- 2.54.0