Skip to content

Commit

Permalink
ERC: fix overlapping menus and non-closing menus on rmb click
Browse files Browse the repository at this point in the history
  • Loading branch information
enricoros committed Feb 24, 2025
1 parent dfbb346 commit e90bcdf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/modules/blocks/enhanced-code/EnhancedRenderCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ export function EnhancedRenderCode(props: {

const handleToggleContextMenu = React.useCallback((event: React.MouseEvent<HTMLElement>) => {
event.preventDefault(); // added for the Right mouse click (to prevent the menu)
event.stopPropagation();

// NOTE: disabled because a click here won't close other menus (won't trigger other component's ClickAwayListeners)
// event.stopPropagation();

setContextMenuAnchor(anchor => anchor ? null : event.currentTarget);
}, []);

Expand Down Expand Up @@ -147,7 +150,7 @@ export function EnhancedRenderCode(props: {
<IconButton
size='sm'
onClick={handleToggleContextMenu}
onContextMenu={handleToggleContextMenu}
// onContextMenu={handleToggleContextMenu} // NOTE: disabled because onContextMenu prevents */ClickAwayListeners
sx={{ mr: -0.5 }}
>
<MoreVertIcon />
Expand Down

0 comments on commit e90bcdf

Please sign in to comment.