Skip to content

Commit 6b31b1d

Browse files
committed
fix: Dialogue - Portal stacking for NestedMenu
- render Dialogue through Portal instead of document.body - lower overlay and dialog z-index from 50 to 10 - let NestedMenu and Popup (z-index 11) appear above Dialogue
1 parent 7c43efd commit 6b31b1d

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

src/components/Dialogue/Dialogue.styl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.dialogOverlay
44
position fixed
55
inset 0
6-
z-index 50
6+
z-index 10
77
background-color var(--decent-color-alpha-900)
88
backdrop-filter blur(4px)
99
opacity 0
@@ -20,7 +20,7 @@
2020
position fixed
2121
left 50%
2222
top 50%
23-
z-index 50
23+
z-index 10
2424
display flex
2525
flex-direction column
2626
width fit-content

src/components/Dialogue/Dialogue.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import cn from 'classnames';
22
import { useEffect, useId, useRef, useState } from 'react';
3-
import { createPortal } from 'react-dom';
43

54
import {
65
Card,
@@ -9,6 +8,7 @@ import {
98
CardHeader,
109
} from 'uilib/components/Card/Card';
1110
import { Icon } from 'uilib/components/Icon/Icon';
11+
import { Portal } from 'uilib/components/Portal/Portal';
1212
import { isBrowser } from 'uilib/tools/env';
1313

1414
import S from './Dialogue.styl';
@@ -207,11 +207,9 @@ export function Dialogue({
207207
return (
208208
<>
209209
{trigger && <div onClick={onTriggerClick}>{trigger}</div>}
210-
{open &&
211-
!disabled &&
212-
isMounted &&
213-
isBrowser &&
214-
createPortal(dialogueContent, document.body)}
210+
{open && !disabled && isMounted && isBrowser && (
211+
<Portal>{dialogueContent}</Portal>
212+
)}
215213
</>
216214
);
217215
}

0 commit comments

Comments
 (0)