diff --git a/vscode/webview-ui/src/components/property-grid.tsx b/vscode/webview-ui/src/components/property-grid.tsx index 3245996..fcd165d 100644 --- a/vscode/webview-ui/src/components/property-grid.tsx +++ b/vscode/webview-ui/src/components/property-grid.tsx @@ -531,6 +531,11 @@ function PropertyRow({ ref={el => registerCellRef(fullKey, el)} data-property-cell={fullKey} onClickCapture={(e) => { + // portal 弹层对祖先捕获处理器隐身:点击落在 SelectMenu 弹层内时不选中也不拦截, + // 让 click 正常落到选项按钮,避免被外层的 stopPropagation/preventDefault 吞掉。 + const src = e.target + if (src instanceof Element && src.closest('[data-select-menu]')) + return if (isSelected) return onSelect(fullKey) @@ -606,8 +611,11 @@ export function PropertyGrid({ if (selectedKey == null) return function handleMouseDown(e: MouseEvent): void { + const t = e.target + if (!(t instanceof Node)) + return const root = rootRef.current - if (root && e.target instanceof Node && !root.contains(e.target)) + if (root && !root.contains(t) && !(t instanceof Element && t.closest('[data-select-menu]'))) setSelectedKey(null) } document.addEventListener('mousedown', handleMouseDown) diff --git a/vscode/webview-ui/src/components/ui/select-menu.tsx b/vscode/webview-ui/src/components/ui/select-menu.tsx index ccb022c..128e6f8 100644 --- a/vscode/webview-ui/src/components/ui/select-menu.tsx +++ b/vscode/webview-ui/src/components/ui/select-menu.tsx @@ -211,6 +211,7 @@ export function SelectMenu({