authorgravatar for 76637177+SunkenInTime@users.noreply.github.comDara Adedeji <76637177+SunkenInTime@users.noreply.github.com> 2026-10-13 13:37:33-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-13 12:37:33-05:00
log446be6933f4ecc207eed94db361ff40a88c3964f
tree7300e6812aa11be43890be6c425acd2469c66984
parent6a68bee34f5ecfd478b6e2bd0af2ce39c0c32583
signature Signed by PGP key B5690EEEBB952194

fix(web): Cmd+Enter creates the new project while an option is highlighted (#18901)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

1 files changed, 14 insertions(+), 7 deletions(-)

apps/web/src/components/CommandPalette.tsx+14-7
...@@ -3072,6 +3072,10 @@ function OpenCommandPaletteDialog(props: {...@@ -3072,6 +3072,10 @@ function OpenCommandPaletteDialog(props: {
3072 ? "Create & Add"3072 ? "Create & Add"
3073 : "Add";3073 : "Add";
3074 const addShortcutLabel = hasHighlightedBrowseItem ? `${submitModifierLabel} Enter` : "Enter";3074 const addShortcutLabel = hasHighlightedBrowseItem ? `${submitModifierLabel} Enter` : "Enter";
3075 const hasHighlightedNewProjectItem = newProjectFlow !== null && highlightedItemValue !== null;
3076 const createShortcutLabel = hasHighlightedNewProjectItem
3077 ? `${submitModifierLabel} Enter`
3078 : "Enter";
3075 const remoteProjectButtonLabel = addProjectCloneFlow3079 const remoteProjectButtonLabel = addProjectCloneFlow
3076 ? addProjectCloneFlow.source === "url"3080 ? addProjectCloneFlow.source === "url"
3077 ? "Continue"3081 ? "Continue"
...@@ -3165,15 +3169,17 @@ function OpenCommandPaletteDialog(props: {...@@ -3165,15 +3169,17 @@ function OpenCommandPaletteDialog(props: {
3165 }3169 }
31663170
3167 // Enter creates the project unless an item below the name is3171 // Enter creates the project unless an item below the name is
3168 // highlighted, in which case it runs that item.3172 // highlighted, in which case it runs that item. Mod+Enter always creates.
3169 if (3173 if (
3170 newProjectFlow !== null &&3174 newProjectFlow !== null &&
3171 event.key === "Enter" &&3175 event.key === "Enter" &&
3172 highlightedItemValue === null &&3176 (!hasHighlightedNewProjectItem || isPrimaryModifierPressed(event)) &&
3173 // Enter that confirms an IME composition is part of typing the name.3177 // Enter that confirms an IME composition is part of typing the name.
3174 !event.nativeEvent.isComposing &&3178 !event.nativeEvent.isComposing &&
3175 event.keyCode !== 2293179 event.keyCode !== 229
3176 ) {3180 ) {
3181 // Base UI would otherwise also click the highlighted row.
3182 (event as typeof event & { preventBaseUIHandler?: () => void }).preventBaseUIHandler?.();
3177 event.preventDefault();3183 event.preventDefault();
3178 void submitNewProject();3184 void submitNewProject();
3179 return;3185 return;
...@@ -3383,7 +3389,7 @@ function OpenCommandPaletteDialog(props: {...@@ -3383,7 +3389,7 @@ function OpenCommandPaletteDialog(props: {
3383 size="xs"3389 size="xs"
3384 tabIndex={-1}3390 tabIndex={-1}
3385 className="absolute inset-e-2.5 top-1/2 -translate-y-1/2"3391 className="absolute inset-e-2.5 top-1/2 -translate-y-1/2"
3386 aria-label="Create (Enter)"3392 aria-label={`Create (${createShortcutLabel})`}
3387 disabled={!canSubmitNewProject}3393 disabled={!canSubmitNewProject}
3388 onMouseDown={(event) => {3394 onMouseDown={(event) => {
3389 event.preventDefault();3395 event.preventDefault();
...@@ -3396,10 +3402,10 @@ function OpenCommandPaletteDialog(props: {...@@ -3396,10 +3402,10 @@ function OpenCommandPaletteDialog(props: {
3396 >3402 >
3397 <span>{isCreatingNewProject ? "Creating" : "Create"}</span>3403 <span>{isCreatingNewProject ? "Creating" : "Create"}</span>
3398 <KbdGroup className="pointer-events-none -me-0.5">3404 <KbdGroup className="pointer-events-none -me-0.5">
3399 <Kbd>Enter</Kbd>3405 <Kbd>{createShortcutLabel}</Kbd>
3400 </KbdGroup>3406 </KbdGroup>
3401 </TooltipTrigger>3407 </TooltipTrigger>
3402 <TooltipPopup side="top">Create (Enter)</TooltipPopup>3408 <TooltipPopup side="top">{`Create (${createShortcutLabel})`}</TooltipPopup>
3403 </Tooltip>3409 </Tooltip>
3404 ) : addProjectCloneFlow?.step === "repository" ? (3410 ) : addProjectCloneFlow?.step === "repository" ? (
3405 <Tooltip>3411 <Tooltip>
...@@ -3512,8 +3518,9 @@ function OpenCommandPaletteDialog(props: {...@@ -3512,8 +3518,9 @@ function OpenCommandPaletteDialog(props: {
3512 inputProps={{3518 inputProps={{
3513 // The submit button is absolutely positioned over the field, so the3519 // The submit button is absolutely positioned over the field, so the
3514 // inner input must reserve enough room for the full action label.3520 // inner input must reserve enough room for the full action label.
3515 className:3521 className: hasHighlightedNewProjectItem
3516 addProjectCloneFlow?.step === "repository" || newProjectFlow !== null3522 ? "*:data-[slot=autocomplete-input]:pe-38!"
3523 : addProjectCloneFlow?.step === "repository" || newProjectFlow !== null
3517 ? "*:data-[slot=autocomplete-input]:pe-32!"3524 ? "*:data-[slot=autocomplete-input]:pe-32!"
3518 : isBrowsing3525 : isBrowsing
3519 ? browseInputEndPaddingClass({3526 ? browseInputEndPaddingClass({