From c7d2545ec7bbcdba30b775453d53df5a359410bd Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Thu, 21 Sep 2023 15:35:27 +0800
Subject: Revert dialog.

---
 FrontEnd/src/components/menu/PopupMenu.tsx | 40 ++++++++++++++----------------
 1 file changed, 18 insertions(+), 22 deletions(-)

(limited to 'FrontEnd/src/components/menu/PopupMenu.tsx')

diff --git a/FrontEnd/src/components/menu/PopupMenu.tsx b/FrontEnd/src/components/menu/PopupMenu.tsx
index 7ac2abfe..b00bc2ed 100644
--- a/FrontEnd/src/components/menu/PopupMenu.tsx
+++ b/FrontEnd/src/components/menu/PopupMenu.tsx
@@ -1,6 +1,5 @@
 import { useState, CSSProperties, ReactNode } from "react";
 import classNames from "classnames";
-import { createPortal } from "react-dom";
 import { usePopper } from "react-popper";
 
 import { ThemeColor } from "../common";
@@ -46,27 +45,24 @@ export default function PopupMenu({
       onClick={() => setShow(true)}
     >
       {children}
-      {show &&
-        createPortal(
-          <div
-            ref={setPopperElement}
-            className={`cru-popup-menu-menu-container cru-clickable-${
-              color ?? "primary"
-            }`}
-            style={styles.popper}
-            {...attributes.popper}
-          >
-            <Menu
-              items={items}
-              onItemClick={(e) => {
-                setShow(false);
-                e.stopPropagation();
-              }}
-            />
-          </div>,
-          // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-          document.getElementById("portal")!,
-        )}
+      {show && (
+        <div
+          ref={setPopperElement}
+          className={`cru-popup-menu-menu-container cru-clickable-${
+            color ?? "primary"
+          }`}
+          style={styles.popper}
+          {...attributes.popper}
+        >
+          <Menu
+            items={items}
+            onItemClick={(e) => {
+              setShow(false);
+              e.stopPropagation();
+            }}
+          />
+        </div>
+      )}
     </div>
   );
 }
-- 
cgit v1.2.3

