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: {
30723072 ? "Create & Add"
30733073 : "Add";
30743074 const addShortcutLabel = hasHighlightedBrowseItem ? `${submitModifierLabel} Enter` : "Enter";
3075 const hasHighlightedNewProjectItem = newProjectFlow !== null && highlightedItemValue !== null;
3076 const createShortcutLabel = hasHighlightedNewProjectItem
3077 ? `${submitModifierLabel} Enter`
3078 : "Enter";
30753079 const remoteProjectButtonLabel = addProjectCloneFlow
30763080 ? addProjectCloneFlow.source === "url"
30773081 ? "Continue"
......@@ -3165,15 +3169,17 @@ function OpenCommandPaletteDialog(props: {
31653169 }
31663170
31673171 // 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.
31693173 if (
31703174 newProjectFlow !== null &&
31713175 event.key === "Enter" &&
3172 highlightedItemValue === null &&
3176 (!hasHighlightedNewProjectItem || isPrimaryModifierPressed(event)) &&
31733177 // Enter that confirms an IME composition is part of typing the name.
31743178 !event.nativeEvent.isComposing &&
31753179 event.keyCode !== 229
31763180 ) {
3181 // Base UI would otherwise also click the highlighted row.
3182 (event as typeof event & { preventBaseUIHandler?: () => void }).preventBaseUIHandler?.();
31773183 event.preventDefault();
31783184 void submitNewProject();
31793185 return;
......@@ -3383,7 +3389,7 @@ function OpenCommandPaletteDialog(props: {
33833389 size="xs"
33843390 tabIndex={-1}
33853391 className="absolute inset-e-2.5 top-1/2 -translate-y-1/2"
3386 aria-label="Create (Enter)"
3392 aria-label={`Create (${createShortcutLabel})`}
33873393 disabled={!canSubmitNewProject}
33883394 onMouseDown={(event) => {
33893395 event.preventDefault();
......@@ -3396,10 +3402,10 @@ function OpenCommandPaletteDialog(props: {
33963402 >
33973403 <span>{isCreatingNewProject ? "Creating" : "Create"}</span>
33983404 <KbdGroup className="pointer-events-none -me-0.5">
3399 <Kbd>Enter</Kbd>
3405 <Kbd>{createShortcutLabel}</Kbd>
34003406 </KbdGroup>
34013407 </TooltipTrigger>
3402 <TooltipPopup side="top">Create (Enter)</TooltipPopup>
3408 <TooltipPopup side="top">{`Create (${createShortcutLabel})`}</TooltipPopup>
34033409 </Tooltip>
34043410 ) : addProjectCloneFlow?.step === "repository" ? (
34053411 <Tooltip>
......@@ -3512,8 +3518,9 @@ function OpenCommandPaletteDialog(props: {
35123518 inputProps={{
35133519 // The submit button is absolutely positioned over the field, so the
35143520 // inner input must reserve enough room for the full action label.
3515 className:
3516 addProjectCloneFlow?.step === "repository" || newProjectFlow !== null
3521 className: hasHighlightedNewProjectItem
3522 ? "*:data-[slot=autocomplete-input]:pe-38!"
3523 : addProjectCloneFlow?.step === "repository" || newProjectFlow !== null
35173524 ? "*:data-[slot=autocomplete-input]:pe-32!"
35183525 : isBrowsing
35193526 ? browseInputEndPaddingClass({