-
I have a I have this code : <>
<ContextMenu>
<ContextMenuTrigger>
<div ref={mapContainer} className='w-screen h-screen z-40' />
</ContextMenuTrigger>
<ContextMenuContent>
<ContextMenuItem>Profile</ContextMenuItem>
<ContextMenuItem>Billing</ContextMenuItem>
<ContextMenuItem>Team</ContextMenuItem>
<ContextMenuItem>Subscription</ContextMenuItem>
</ContextMenuContent>
</ContextMenu>
<div className='absolute left-6 bottom-20 top-16 flex-1 flex gap-2 right-6'>
<BuildingInformationView />
</div>
<div className='absolute right-20 bottom-20 z-40 w-64'>
<MapViewerControls />
</div>
<div className='z-40 absolute bottom-20 right-2 flex flex-col gap-2 items-center'>
<Zoom mapRef={mapRef} />
<Separator className='w-6' />
<Compass />
<Layers zoom={currentZoom} />
</div>
</> The problem is though I wrapped the map with the Context Menu but it's not triggered. |
Beta Was this translation helpful? Give feedback.
Answered by
Razz21
Feb 27, 2025
Replies: 1 comment 1 reply
-
Check out, if default containerDiv.addEventListener("contextmenu", (e) => {
e.preventDefault(); // <-- prevents from displaying browser context menu, but also may affect <ContextMenuTrigger> behaviour
e.stopPropagation(); // <-- same
//...
}); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
alamenai
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Check out, if default
contextmenu
behaviour in your trigger component is not disabled.