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

Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Dara AdedejiandClaude Opus 5.5 authored and GitHub committed 2026-10-13 12:37:33 -05:00
1 parent 6a68bee34f
commit 446be6933f
1 file changed
+14 -7
+14 -7
View File
@@ -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: {
>
<span>{isCreatingNewProject ? "Creating" : "Create"}</span>
<KbdGroup className="pointer-events-none -me-0.5">
<Kbd>Enter</Kbd>
<Kbd>{createShortcutLabel}</Kbd>
</KbdGroup>
</TooltipTrigger>
<TooltipPopup side="top">Create (Enter)</TooltipPopup>
<TooltipPopup side="top">{`Create (${createShortcutLabel})`}</TooltipPopup>
</Tooltip>
) : addProjectCloneFlow?.step === "repository" ? (
<Tooltip>
@@ -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({