fix(header): 账号菜单不再在指针移出头像时关闭 - #933
Conversation
鼠标从头像走到菜单必然经过两者之间的空隙,pointerleave 让菜单 在指针到达之前就关闭,账号中心、修改密码、退出登录三项鼠标点不到。
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Reviewed the complete fixed diff for the account-menu dismissal contract and its regression coverage. Removing onPointerLeave correctly preserves the menu while the pointer traverses the gap to the absolutely positioned menu, while outside pointerdown, Escape, focus exit, and item selection still provide close paths. I found no actionable correctness, compatibility, or maintainability issues introduced by this PR.
Verification: git diff --check passed. The targeted test could not run in this checkout because frontend dependencies are unavailable and vitest returned Permission denied.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #933 +/- ##
=======================================
Coverage 91.27% 91.27%
=======================================
Files 193 193
Lines 13204 13204
=======================================
Hits 12052 12052
Misses 1152 1152
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
补一条部署信息:windup.xin 当前发的还是 8-29 那次构建(/assets/workflow-Ct_ZmcW0.js 里能直接看到 onPointerLeave:h.close),main 上 8-31 的 #767 也还没上去,所以这个 PR 合了之后还需要一次重新构建部署才能到用户手上。 |
可以。我会手动部署一下。 |
Summary
移除账号区域的
onPointerLeave={accountMenu.close}。菜单是点击打开的,却按 hover 菜单的方式关闭;而菜单绝对定位在区域外(8px 垂直空隙 + 向左探出约 66px),鼠标从头像走向菜单必然先离开区域,菜单在指针到达前就关掉,「账号中心」「修改密码」「退出登录」三项鼠标点不到。关闭仍由区域外
pointerdown、Escape、焦点移出、点击菜单项四条路径覆盖。原测试断言「指针移出即关闭」,改为断言「指针移出后保持打开」,并在用例名里写清为什么。
Verification
真实构建产物 + 真实鼠标轨迹(Chromium 1440×900,从头像中心分 20 步移到「账号中心」):
新增的回归用例在未修复代码上失败(
expected 'closing' to be 'open'),在本 PR 上通过。npm run format:checknpm run lintnpm run typechecknpm run test:coverage(89 files / 1387 tests passed)npm run buildCloses #932