Skip to content

Commit

Permalink
fix(components): remove className from dialog portals (shadcn-ui#1606)
Browse files Browse the repository at this point in the history
Fixes shadcn-ui#1595, shadcn-ui#1644

This PR changes the components that use the `DialogPortal` element to be aliases rather than components that pass a className prop.

The `DialogPortalProps` type from `@radix/react-dialog` recently had a patch update that probably should have been a minor or maybe a major update which is causing a few people to see the error `Property 'className' does not exist on type 'DialogPortalProps'`.

Since the `DialogPortal` component doesn't actually output any DOM elements, it never technically supported the `className` prop and the fact that it surfaced that prop was really a bug.

The `AlertDialog` and `Dialog` components were updated in shadcn-ui#1603, but the `Sheet` component still references `className` which is resolved in this PR.
  • Loading branch information
lachieh authored Oct 21, 2023
1 parent 8acb8d1 commit b92df9a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
8 changes: 1 addition & 7 deletions apps/www/registry/default/ui/sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@ const SheetTrigger = SheetPrimitive.Trigger

const SheetClose = SheetPrimitive.Close

const SheetPortal = ({
className,
...props
}: SheetPrimitive.DialogPortalProps) => (
<SheetPrimitive.Portal className={cn(className)} {...props} />
)
SheetPortal.displayName = SheetPrimitive.Portal.displayName
const SheetPortal = SheetPrimitive.Portal

const SheetOverlay = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Overlay>,
Expand Down
8 changes: 1 addition & 7 deletions apps/www/registry/new-york/ui/sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@ const SheetTrigger = SheetPrimitive.Trigger

const SheetClose = SheetPrimitive.Close

const SheetPortal = ({
className,
...props
}: SheetPrimitive.DialogPortalProps) => (
<SheetPrimitive.Portal className={cn(className)} {...props} />
)
SheetPortal.displayName = SheetPrimitive.Portal.displayName
const SheetPortal = SheetPrimitive.Portal

const SheetOverlay = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Overlay>,
Expand Down

0 comments on commit b92df9a

Please sign in to comment.