mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
popup menu - fix popup placement
This commit is contained in:
parent
327f2140cf
commit
836f48c810
@ -174,7 +174,15 @@ export function ContextMenu({ left, top, children }) {
|
||||
await sleep(0);
|
||||
hideMenu();
|
||||
});
|
||||
return <ContextMenuStyled style={{ left: `${left}px`, top: `${top}px` }}>{children}</ContextMenuStyled>;
|
||||
const menuRef = React.useRef(null);
|
||||
React.useEffect(() => {
|
||||
if (menuRef.current) fixPopupPlacement(menuRef.current);
|
||||
}, [menuRef.current]);
|
||||
return (
|
||||
<ContextMenuStyled ref={menuRef} style={{ left: `${left}px`, top: `${top}px` }}>
|
||||
{children}
|
||||
</ContextMenuStyled>
|
||||
);
|
||||
}
|
||||
|
||||
// export class ContextMenu extends React.Component<IContextMenuProps> {
|
||||
|
Loading…
Reference in New Issue
Block a user