Skip to content

Commit c71b0fb

Browse files
committed
feat: wrap CommandDialog content in DialogPortal for improved rendering
1 parent 9f72457 commit c71b0fb

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/components/command/Command.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react"
22
import {Command as CommandPrimitive} from "cmdk"
33
import {ComponentProps, mergeComponentProps} from "../../utils"
4-
import {Dialog, DialogContent, DialogOverlay} from "../dialog/Dialog"
4+
import {Dialog, DialogContent, DialogOverlay, DialogPortal} from "../dialog/Dialog"
55
import "./Command.style.scss"
66
import {Badge} from "../badge/Badge"
77
import {TextInput, TextInputProps} from "../form"
@@ -29,12 +29,14 @@ export const Command: React.FC<CommandProps> = (props) => {
2929
export const CommandDialog: React.FC<CommandDialogProps> = (props) => {
3030
return (
3131
<Dialog {...props.dialogProps} open={props.open} onOpenChange={props.onOpenChange}>
32-
<DialogOverlay/>
33-
<DialogContent className={"command__dialog"} {...props.contentProps}>
34-
<Command {...props} h={"100%"}>
35-
{props.children}
36-
</Command>
37-
</DialogContent>
32+
<DialogPortal>
33+
<DialogOverlay/>
34+
<DialogContent className={"command__dialog"} {...props.contentProps}>
35+
<Command {...props} h={"100%"}>
36+
{props.children}
37+
</Command>
38+
</DialogContent>
39+
</DialogPortal>
3840
</Dialog>
3941
)
4042
}

0 commit comments

Comments
 (0)