Skip to content

Commit 950999b

Browse files
committed
Hide dialog when not supported
1 parent abc66b6 commit 950999b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/mdx/src/mini-editor/expand-button.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,22 @@ export function ExpandButton({
1616
className?: string
1717
}) {
1818
const [expanded, setExpanded] = React.useState(false)
19+
const [dialogSupported, setDialogSupported] =
20+
React.useState(true)
1921
const ref = React.useRef<any>(null)
2022
const files = step.files
23+
24+
// check if <dialog /> is supported
25+
React.useEffect(() => {
26+
if (ref.current && !ref.current.showModal) {
27+
setDialogSupported(false)
28+
}
29+
}, [])
30+
31+
if (!dialogSupported) {
32+
return null
33+
}
34+
2135
return (
2236
<>
2337
<ExpandIcon

0 commit comments

Comments
 (0)