Remove duplicate close button from OnboardingWalkthrough dialog#988
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The DialogContent component already provides a built-in accessible close button via Radix DialogPrimitive.Close. Removed the manually rendered close button and its wrapping div from the DialogHeader to eliminate the two overlapping × buttons in the upper-right corner. Also removed the unused X import from lucide-react. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Removes a redundant close button from the OnboardingWalkthrough dialog header so the dialog relies on the shared DialogContent built-in close control (avoiding two overlapping × buttons).
Changes:
- Removed the manually-rendered header close button and its wrapper layout.
- Removed the unused
Ximport fromlucide-react.
| <DialogTitle className="flex items-center gap-2"> | ||
| <Rocket className="h-5 w-5 text-primary" /> | ||
| Welcome to ObjectUI | ||
| </DialogTitle> |
There was a problem hiding this comment.
This change removes the custom close button, but there isn't a regression test ensuring the dialog renders only a single close control and that clicking the remaining built-in close button still calls dismiss() (persisting to localStorage). Consider adding a test that asserts a single Close-labeled button and verifies dismissal via that button.
| @@ -102,16 +101,10 @@ export function OnboardingWalkthrough() { | |||
| <Dialog open={open} onOpenChange={(v: any) => { if (!v) dismiss(); }}> | |||
There was a problem hiding this comment.
onOpenChange is typed as (v: any) even though Radix Dialog passes a boolean. Now that dismissal relies on this callback, it would be better to type this parameter as boolean (and optionally update state from v) to keep type-safety and avoid masking mistakes.
| <Dialog open={open} onOpenChange={(v: any) => { if (!v) dismiss(); }}> | |
| <Dialog open={open} onOpenChange={(v: boolean) => { if (!v) dismiss(); }}> |
OnboardingWalkthroughmanually renders a close<Button>in theDialogHeader, butDialogContentalready includes aDialogPrimitive.Closebutton at the same position — producing two overlapping × buttons.<Button><X /></Button>and its wrapping flexdivfrom the headerXimport fromlucide-reactDismissal continues to work via
DialogContent's built-in close button, which triggersDialog'sonOpenChange→dismiss(). ESC and overlay click are unaffected.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.