Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

fix(web): keep a long path from running under the folder picker button (#4823)

Simon Dobaa38cac81d82b
diff --git a/apps/web/src/components/CommandPalette.logic.test.ts b/apps/web/src/components/CommandPalette.logic.test.ts
index 06dabc5e8..17949b7c9 100644
--- a/apps/web/src/components/CommandPalette.logic.test.ts
+++ b/apps/web/src/components/CommandPalette.logic.test.ts
@@ -2,6 +2,7 @@ import { describe, expect, it, vi } from "vite-plus/test";
import { EnvironmentId, ProjectId, ProviderInstanceId, ThreadId } from "@t3tools/contracts";
import type { Thread } from "../types";
import {
+ browseInputEndPaddingClass,
buildBrowseGroups,
buildThreadActionItems,
enumerateCommandPaletteItems,
@@ -10,6 +11,35 @@ import {
type CommandPaletteGroup,
} from "./CommandPalette.logic";
+describe("browseInputEndPaddingClass", () => {
+ it("reserves the widest space for the create action", () => {
+ expect(
+ browseInputEndPaddingClass({
+ willCreateProjectPath: true,
+ hasHighlightedBrowseItem: false,
+ }),
+ ).toContain("pe-38");
+ });
+
+ it("reserves space for the wider highlighted-item shortcut", () => {
+ expect(
+ browseInputEndPaddingClass({
+ willCreateProjectPath: false,
+ hasHighlightedBrowseItem: true,
+ }),
+ ).toContain("pe-30");
+ });
+
+ it("keeps the compact reserve for the normal add action", () => {
+ expect(
+ browseInputEndPaddingClass({
+ willCreateProjectPath: false,
+ hasHighlightedBrowseItem: false,
+ }),
+ ).toContain("pe-24");
+ });
+});
+
describe("reduceCommandPaletteUiState", () => {
const closedState = { open: false, mode: "command", openIntent: null } as const;
diff --git a/apps/web/src/components/CommandPalette.logic.ts b/apps/web/src/components/CommandPalette.logic.ts
index 07e0e520d..95d7a91b7 100644
--- a/apps/web/src/components/CommandPalette.logic.ts
+++ b/apps/web/src/components/CommandPalette.logic.ts
@@ -15,6 +15,19 @@ export const RECENT_THREAD_LIMIT = 12;
export const ITEM_ICON_CLASS = "size-4 text-icon-muted";
export const ADDON_ICON_CLASS = "size-4";
+export function browseInputEndPaddingClass(input: {
+ readonly willCreateProjectPath: boolean;
+ readonly hasHighlightedBrowseItem: boolean;
+}): string {
+ if (input.willCreateProjectPath) {
+ return "*:data-[slot=autocomplete-input]:pe-38!";
+ }
+ if (input.hasHighlightedBrowseItem) {
+ return "*:data-[slot=autocomplete-input]:pe-30!";
+ }
+ return "*:data-[slot=autocomplete-input]:pe-24!";
+}
+
/**
* The global search overlay hosts three mutually exclusive surfaces: the
* command palette (⌘K), the project file picker (⌘P), and project content
diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx
index 48471accb..413ebca30 100644
--- a/apps/web/src/components/CommandPalette.tsx
+++ b/apps/web/src/components/CommandPalette.tsx
@@ -98,6 +98,7 @@ import {
} from "../wslPaths";
import {
ADDON_ICON_CLASS,
+ browseInputEndPaddingClass,
buildBrowseGroups,
buildProjectActionItems,
buildRootGroups,
@@ -2345,13 +2346,16 @@ function OpenCommandPaletteDialog(props: {
footerTrailing={footerTrailing}
inputAccessory={inputAccessory}
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"
- ? "pe-32"
+ ? "*:data-[slot=autocomplete-input]:pe-32!"
: isBrowsing
- ? willCreateProjectPath
- ? "pe-36"
- : "pe-16"
+ ? browseInputEndPaddingClass({
+ willCreateProjectPath,
+ hasHighlightedBrowseItem,
+ })
: undefined,
placeholder: inputPlaceholder,
wrapperClassName: isSubmenu