Skip to content

Commit 744a70d

Browse files
committed
fix(trace-viewer): Render loading dialog in middle of screen
1 parent 3a5a32d commit 744a70d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/web/src/shared/dialog.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const Dialog: React.FC<React.PropsWithChildren<DialogProps>> = ({
4848
const [_, setRecalculateDimensionsCount] = React.useState(0);
4949
const [dialogMeasure] = useMeasureForRef(dialogRef);
5050
const [anchorMeasure, recalculateAnchorMeasure] = useMeasureForRef(anchor);
51-
const position = dialogPosition(dialogMeasure, anchorMeasure, verticalOffset);
51+
const position = anchor ? dialogPosition(dialogMeasure, anchorMeasure, verticalOffset) : undefined;
5252

5353
React.useEffect(() => {
5454
const onClick = (event: MouseEvent) => {
@@ -106,10 +106,10 @@ export const Dialog: React.FC<React.PropsWithChildren<DialogProps>> = ({
106106
return (
107107
<dialog ref={dialogRef} style={{
108108
position: 'fixed',
109-
margin: 0,
109+
margin: position ? 0 : undefined,
110110
zIndex: 110, // on top of split view resizer
111-
top: position.top,
112-
left: position.left,
111+
top: position?.top,
112+
left: position?.left,
113113
minWidth: minWidth || 0,
114114
...externalStyle,
115115
}} className={className} data-testid={dataTestId}>

0 commit comments

Comments
 (0)