mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-05-06 18:22:44 +08:00
fix(ContextMenu): prevent event propagation on menu click to improve usability
This commit is contained in:
@@ -255,17 +255,20 @@ export const ContextMenu: React.FC<ContextMenuProps> = (props) => {
|
|||||||
height="auto"
|
height="auto"
|
||||||
styles={{ body: { padding: 8 } }}
|
styles={{ body: { padding: 8 } }}
|
||||||
>
|
>
|
||||||
<Menu
|
<div onClick={(e) => e.stopPropagation()}>
|
||||||
items={items}
|
<Menu
|
||||||
selectable={false}
|
items={items}
|
||||||
onClick={({ key }) => {
|
mode="inline"
|
||||||
const handler = handlerMap.get(String(key));
|
selectable={false}
|
||||||
if (!handler) return;
|
onClick={({ key }) => {
|
||||||
handler();
|
const handler = handlerMap.get(String(key));
|
||||||
onClose();
|
if (!handler) return;
|
||||||
}}
|
handler();
|
||||||
style={{ borderRadius: token.borderRadius, background: 'transparent', border: 'none' }}
|
onClose();
|
||||||
/>
|
}}
|
||||||
|
style={{ borderRadius: token.borderRadius, background: 'transparent', border: 'none' }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</Drawer>
|
</Drawer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user