shadcn-ui / ui

Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.
https://ui.shadcn.com
MIT License
76.39k stars 4.81k forks source link

[bug]: Dialog abstraction throwsDialogContent requires a DialogTitle since last update #5924

Open Alicehhhmm opened 2 weeks ago

Alicehhhmm commented 2 weeks ago

Describe the bug

Current Behavior

Error message about using @radix-ui/react-dialog library for shadcn components

Affected component/components

command

How to reproduce

ERROR

Dialog abstraction throwsDialogContent requires a DialogTitle since last update

image

Expected behavior

There is no error when using shadcn components associated with @radix-ui/react-dialog for example: command

My local solution

components/ui/dialog

import * as DialogPrimitive from '@radix-ui/react-dialog'

const DialogContent = React.forwardRef<
  ....
>(({ className, children, ...props }, ref) => (
    <DialogPortal>
        ....
        <DialogPrimitive.Content
            ....
+            aria-describedby={undefined}
        >
+             <DialogPrimitive.Title className='hidden'>visually hidden</DialogPrimitive.Title>
            {children}
             ....
        </DialogPrimitive.Content>
    </DialogPortal>
))

correlation lssues

#4302 #5474 #5698 #5746

radix-ui lssues

#2986

Codesandbox/StackBlitz link

https://ui.shadcn.com/docs/components/command

Logs

No response

System Info

[✔] Environment
    - OS: Windows 10.0.19045 x86_64 (X64)
    - node: 20.17.0
    - pnpm: 9.10.0
    - yarn: 1.22.22
    - npm: 10.7.0

Before submitting

OlegGulevskyy commented 1 week ago

same goes for Sheet component, that is used in Sidebar thanks for the workaround @Alicehhhmm !

LucasHang commented 4 days ago

I guess that ideally the place that should be fixed is the implementation of those components. In a normal use of Dialog or Sheet you would put a Title and/or description as a children, but in SideBar the Sheet is used without it, so you put the workaround in Sidebar and not at Dialog.

Like this (at ui/sidebar.tsx): image