Repository navigation
refactor(frontend): migrate AddProjectDialog to Radix Dialog - #813
Merged
backnotprop merged 2 commits intoMay 28, 2026
Merged
Conversation
Swap the hand-rolled modal shell (fixed inset-0 overlay, manual backdrop click, manual Escape, if (!open) return null) for the existing shadcn-style Radix Dialog wrapper (components/ui/dialog.tsx), gaining focus-trapping, scroll-lock, and consistent fade/zoom motion shared with AppSettingsDialog. Preserved command-palette behavior: - Top-anchored max-w-lg layout via className overrides on DialogContent (top-[15vh] translate-y-0 max-w-lg max-h-none). cn() uses tailwind-merge, so these override the centered/max-w-4xl base classes cleanly. - Search-input autofocus via onOpenAutoFocus (preventDefault + focus input) instead of requestAnimationFrame. - Arrow/Tab/Enter list navigation in the input's onKeyDown is unchanged; Escape is now owned by Radix (manual branch removed, no double-fire). - Custom inline X kept with hideClose (single close button); added a focus-visible ring to match the built-in close button's a11y. - Added sr-only DialogTitle for screen-reader compliance. Directory-listing/typeahead logic, daemonApiClient calls, Recent/Directories rendering, and props are unchanged. Call site (Layout.tsx) needs no change.
…Description - max-h-none did not override the base max-h-[min(640px,85vh)] (tailwind-merge doesn't dedupe none vs arbitrary); inner list max-h-72 already governs height. - Add sr-only DialogDescription to satisfy Radix a11y and silence the dev warning.
backnotprop
added a commit
that referenced
this pull request
May 28, 2026
backnotprop
added a commit
that referenced
this pull request
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Migrates
AddProjectDialog(apps/frontend/src/components/landing/AddProjectDialog.tsx) from a hand-rolled modal to the app's existing shadcn-style Radix Dialog wrapper (components/ui/dialog.tsx), the same oneAppSettingsDialoguses. This gains proper focus-trapping, scroll-lock, Escape handling, and consistent fade/zoom motion — and eliminates the second modal implementation in the app.The directory-listing/typeahead logic,
daemonApiClient.listDirectoriescalls, Recent/Directories rendering, and the component's props are unchanged. This is purely a presentational/behavioral swap of the modal shell.Removed (now provided by Radix)
fixed inset-0 z-50 … backdrop-bluroverlay + nested panel wrappers →DialogOverlay(insideDialogContent)onPointerDownOutsideEscapebranch inhandleKeyDown→ RadixonEscapeKeyDown(no double-fire; the input's keydown no longer touches Escape)if (!open) return null→<Dialog open={open}>controls mountingrequestAnimationFrame(() => inputRef.current?.focus())→onOpenAutoFocusPreserved command-palette behavior
max-w-lglayout. Overridden viaclassName="top-[15vh] max-w-lg translate-y-0 max-h-none"onDialogContent. (Seecn()finding below.)onOpenAutoFocus={(e) => { e.preventDefault(); inputRef.current?.focus(); }}.onKeyDownis unchanged. Escape is now owned by Radix.a11y / polish
hideCloseto suppress the built-in one — exactly one close button. Addedfocus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50to it so its focus state matches the built-in close button.sr-onlyDialogTitle("Add a project") — Radix requires a title for screen readers (mirrorsAppSettingsDialog).cn()tailwind-merge findingcn()DOES use tailwind-merge (apps/frontend/src/lib/utils.ts→twMerge(clsx(inputs))). So theclassNameoverrides onDialogContentcleanly replace the base classes rather than appending alongside conflicting ones:top-[50%]→top-[15vh]translate-y-[-50%]→translate-y-0max-w-4xl→max-w-lgmax-h-[min(640px,85vh)]→max-h-none(restores the original panel's no-max-height; the inner list keeps its ownmax-h-72scroll cap)left-[50%] translate-x-[-50%]retained → horizontal centering preservedNo explicit inner-wrapper workaround was needed.
Call site
apps/frontend/src/app/Layout.tsx:85(<AddProjectDialog open={addProjectOpen} onOpenChange={setAddProjectOpen} />) is unchanged — props map 1:1 onto<Dialog open onOpenChange>. Typecheck confirms.Verification
bun run typecheck(apps/frontend): no errors inAddProjectDialog.tsx. The only error reported (vitest.browser.config.ts— missing@vitest/browser-playwright) is pre-existing (reproduces with this change stashed) and unrelated.bun run build(apps/frontend): Vite build + single-file build verification pass.bun test: 1329 pass, 0 fail (after the standardvendor.shstep).oxlint/oxfmt --checkon the modified file: clean.Visual/interaction confirmation is deferred to human PR review. There is no React Testing Library or browser automation in this environment, so the four preserved behaviors (top-anchored positioning, search autofocus, keyboard nav, single close button) were reasoned through in adversarial self-review and code-review but not clicked through live. I did not verify it visually.