11import React , { useEffect , useMemo , useRef } from 'react' ;
2- import { Menu , MenuItem , MenuSeparator , useEventListener } from './leafygreen' ;
2+ import { Menu , MenuItem , MenuSeparator } from './leafygreen' ;
33import type { ContextMenuItem } from '@mongodb-js/compass-context-menu' ;
44import { useContextMenu } from '@mongodb-js/compass-context-menu' ;
55import { ContextMenuProvider as ContextMenuProviderBase } from '@mongodb-js/compass-context-menu' ;
@@ -22,7 +22,6 @@ export function ContextMenuProvider({
2222
2323export function ContextMenu ( { menu } : ContextMenuWrapperProps ) {
2424 const menuRef = useRef ( null ) ;
25- const anchorRef = useRef ( null ) ;
2625
2726 const position = menu . position ;
2827 const itemGroups = menu . itemGroups ;
@@ -34,22 +33,19 @@ export function ContextMenu({ menu }: ContextMenuWrapperProps) {
3433 } , [ menu . isOpen ] ) ;
3534
3635 return (
37- < >
38- < div
39- data-testid = "context-menu-anchor"
40- ref = { anchorRef }
41- style = { {
42- position : 'absolute' ,
43- left : position . x ,
44- top : position . y ,
45- // This is to ensure the menu gets positioned correctly as the left and top updates
46- width : 1 ,
47- height : 1 ,
48- } }
49- />
36+ < div
37+ data-testid = "context-menu"
38+ style = { {
39+ position : 'absolute' ,
40+ left : position . x ,
41+ top : position . y ,
42+ // This is to ensure the menu gets positioned correctly as the left and top updates
43+ width : 1 ,
44+ height : 1 ,
45+ } }
46+ >
5047 < Menu
5148 data-testid = "context-menu"
52- refEl = { anchorRef }
5349 ref = { menuRef }
5450 open = { menu . isOpen }
5551 setOpen = { menu . close }
@@ -92,7 +88,7 @@ export function ContextMenu({ menu }: ContextMenuWrapperProps) {
9288 }
9389 ) }
9490 </ Menu >
95- </ >
91+ </ div >
9692 ) ;
9793}
9894
0 commit comments