fix(ContextMenu): prevent event propagation on menu click to improve usability

This commit is contained in:
shiyu
2026-03-15 16:07:23 +08:00
parent f96a4dce11
commit 4038a7292a

View File

@@ -255,17 +255,20 @@ export const ContextMenu: React.FC<ContextMenuProps> = (props) => {
height="auto"
styles={{ body: { padding: 8 } }}
>
<Menu
items={items}
selectable={false}
onClick={({ key }) => {
const handler = handlerMap.get(String(key));
if (!handler) return;
handler();
onClose();
}}
style={{ borderRadius: token.borderRadius, background: 'transparent', border: 'none' }}
/>
<div onClick={(e) => e.stopPropagation()}>
<Menu
items={items}
mode="inline"
selectable={false}
onClick={({ key }) => {
const handler = handlerMap.get(String(key));
if (!handler) return;
handler();
onClose();
}}
style={{ borderRadius: token.borderRadius, background: 'transparent', border: 'none' }}
/>
</div>
</Drawer>
);
}