From 96829f8dcf8c53a0c6f53bc77cdedaf612f2b4bb Mon Sep 17 00:00:00 2001 From: mlclaw Date: Tue, 19 May 2026 11:02:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(contextmenu):=20fix=20submenu=20hover=20gap?= =?UTF-8?q?=20=E2=80=94=20move=20bridge=20pseudo-element=20from=20submenu?= =?UTF-8?q?=20to=20parent=20li?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The existing ::before on .wk-ctx-submenu was placed on the wrong element. The 4px gap between parent li and submenu is outside the submenu boundary, so the bridge had no effect. Mouse leaving the parent li over this gap caused the submenu to disappear immediately. Fix: add ::after on the parent li (li:has(> .wk-ctx-submenu)) to extend its hover area rightward by 8px, covering the gap. Mirror fix for flip-submenu (left-opening) case. Co-Authored-By: Claude Sonnet 4.6 --- .../src/Components/ContextMenus/index.css | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/dmworkbase/src/Components/ContextMenus/index.css b/packages/dmworkbase/src/Components/ContextMenus/index.css index c684e9c8..ad7cd5a1 100644 --- a/packages/dmworkbase/src/Components/ContextMenus/index.css +++ b/packages/dmworkbase/src/Components/ContextMenus/index.css @@ -122,15 +122,14 @@ body[theme-mode=dark] .wk-ctx-submenu { display: block; } -/* 隐形桥接:覆盖父项与子菜单之间的 4px 间隙, - 防止鼠标对角线移动时短暂离开父 li 触发 :hover 失效、子菜单消失 */ -.wk-ctx-submenu::before { +/* Bridge: extend the hover area of the parent li rightward to cover the 4px gap */ +.wk-contextmenus li:has(> .wk-ctx-submenu)::after { content: ""; position: absolute; - top: -4px; - bottom: -4px; - left: -8px; + top: 0; + right: -8px; width: 8px; + height: 100%; } /* 子菜单向左展开(靠近右侧视口边缘时) */ @@ -139,9 +138,9 @@ body[theme-mode=dark] .wk-ctx-submenu { right: calc(100% + 4px); } -.wk-contextmenus-flip-submenu .wk-ctx-submenu::before { - left: auto; - right: -8px; +.wk-contextmenus-flip-submenu li:has(> .wk-ctx-submenu)::after { + right: auto; + left: -8px; } .wk-ctx-submenu li {