diff --git a/ui/src/components/ArtifactFileChip.tsx b/ui/src/components/ArtifactFileChip.tsx index a351c312568..49f2987c7c1 100644 --- a/ui/src/components/ArtifactFileChip.tsx +++ b/ui/src/components/ArtifactFileChip.tsx @@ -50,7 +50,7 @@ export function ArtifactFileChip({ const content = ( <> {showIcon ? : null} - {display} + {display} > ); diff --git a/ui/src/components/FileViewerSheet.test.tsx b/ui/src/components/FileViewerSheet.test.tsx index f648b748271..6d5859598db 100644 --- a/ui/src/components/FileViewerSheet.test.tsx +++ b/ui/src/components/FileViewerSheet.test.tsx @@ -75,6 +75,21 @@ describe("FileContentViewer", () => { expect(markup).toContain("break-words"); }); + it("reserves code gutter space for at least four digit line numbers", () => { + const markup = renderToStaticMarkup( + , + ); + expect(markup).toContain("calc(4ch + 2rem)"); + }); + it("renders video previews with native controls", () => { const markup = renderToStaticMarkup( {lineNumber} @@ -626,28 +631,45 @@ export function FileViewerSheet({ {announcement} {state ? ( - - viewer.open({ - path: state.path, - line: state.line, - column: state.column, - workspace: "project", - projectId: null, - workspaceId: null, - }) - : null - } - /> + + + + + viewer.open({ + path: state.path, + line: state.line, + column: state.column, + workspace: "project", + projectId: null, + workspaceId: null, + }) + : null + } + /> + + ) : browseMode ? ( { expect(html).toContain('data-workspace-file-link="true"'); expect(html).toContain('data-workspace-file-path="videos/90-days-paperclip/out/90-days-paperclip-1x1.mp4"'); + expect(html).toContain("videos/90-days-paperclip/out/90-days-paperclip-1x1.mp4"); + expect(html).not.toContain("max-w-[38ch]"); expect(html).not.toContain("paperclip-markdown-issue-ref"); expect(html).not.toContain('href="/issues/PAP-10306"'); }); diff --git a/ui/src/components/WorkspaceFileBrowser.test.tsx b/ui/src/components/WorkspaceFileBrowser.test.tsx index d70b68f7244..fe9380db403 100644 --- a/ui/src/components/WorkspaceFileBrowser.test.tsx +++ b/ui/src/components/WorkspaceFileBrowser.test.tsx @@ -198,6 +198,12 @@ describe("WorkspaceFileBrowser", () => { expect(onOpen).toHaveBeenCalledWith({ path: "ui/src/pages/IssueDetail.tsx", workspace: "auto" }); }); + it("can render without autofocus when embedded beside a preview", () => { + useQueryMock.mockReturnValue(ok(availableResponse([createItem()]))); + renderBrowser(vi.fn(), { autoFocusSearch: false }); + expect(container.querySelector("input")?.hasAttribute("autofocus")).toBe(false); + }); + it("does not render a Recent/All toggle", () => { useQueryMock.mockReturnValue(ok(availableResponse([createItem()]))); renderBrowser(); diff --git a/ui/src/components/WorkspaceFileBrowser.tsx b/ui/src/components/WorkspaceFileBrowser.tsx index 4c20957410e..96bdbaa901e 100644 --- a/ui/src/components/WorkspaceFileBrowser.tsx +++ b/ui/src/components/WorkspaceFileBrowser.tsx @@ -219,6 +219,7 @@ export interface WorkspaceFileBrowserProps { initialFolderPath?: string | null; initialProjectId?: string | null; initialWorkspaceId?: string | null; + autoFocusSearch?: boolean; className?: string; } @@ -230,6 +231,7 @@ export function WorkspaceFileBrowser({ initialFolderPath, initialProjectId, initialWorkspaceId, + autoFocusSearch = true, className, }: WorkspaceFileBrowserProps) { const [source, setSource] = useState( @@ -512,7 +514,7 @@ export function WorkspaceFileBrowser({ aria-expanded={items.length > 0} aria-controls={items.length > 0 ? listboxId : undefined} aria-activedescendant={activeOptionId} - autoFocus + autoFocus={autoFocusSearch} autoComplete="off" spellCheck={false} className="h-8 pl-8 font-mono text-xs" diff --git a/ui/src/components/WorkspaceFileLink.tsx b/ui/src/components/WorkspaceFileLink.tsx index fe01f658a4b..0075a55973c 100644 --- a/ui/src/components/WorkspaceFileLink.tsx +++ b/ui/src/components/WorkspaceFileLink.tsx @@ -93,7 +93,7 @@ export function WorkspaceFileLink({ ? : ) : null} - {display} + {display} ); }