Skip to content

fix: recover notification hover after notice removal - #413

Closed
tevinch wants to merge 1 commit into
react-component:masterfrom
tevinch:codex/notification-hover-close
Closed

tevinch wants to merge 1 commit into
react-component:masterfrom
tevinch:codex/notification-hover-close

Conversation

@tevinch

@tevinch tevinch commented Sep 28, 2026 •

Copy link
Copy Markdown

Closing the bottom notice in an expanded stack can remove the hovered DOM node without React receiving mouseleave. The remaining notices stay expanded with auto-close timers paused even after the pointer moves outside.

This adds movement recovery while the list is hovered. The event path identifies movement within the list, with native :hover as a fallback for closed shadow roots that hide their internals from document events. Moving within the list keeps timers paused; moving outside resumes the remaining duration. Persistent notices and the configured stack threshold are preserved.

Fixes ant-design/ant-design#59412, Close #383, which addressed the same interaction before the notification list refactor.

Validation:

  • npm test: 57 tests passed, including regressions for 4→3 and 5→4 notices, a custom threshold, repeated use, remaining duration, persistent content, stopped propagation, and nested shadow containers.
  • npm run tsc and npm run compile passed.
  • npm run lint: no errors; 10 existing warnings in unchanged files.
  • Chrome software-driven interaction with antd 6.6.5 and React 19.0.0 reproduced the failure in published notification 2.0.8 and verified the source repair through close, pointer exit, and automatic removal. This was not human manual validation.

Summary by CodeRabbit

  • Bug Fixes
    • 修复通知列表移除悬停通知后,悬停状态未能及时恢复的问题。
    • 修复鼠标移入或移出不同容器(包括 Shadow DOM)时,通知暂停关闭与堆叠展开状态无法正确恢复的问题。
  • Tests
    • 新增测试,覆盖不同悬停场景下通知的关闭与堆叠行为。

@vercel

vercel Bot commented Sep 28, 2026

Copy link
Copy Markdown

@tevinch is attempting to deploy a commit to the afc163's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 0f3da670-26fc-4e0b-bf15-2df657a4855e

📥 Commits

Reviewing files that changed from the base of the PR and between dd2ba0b and d90d379.

📒 Files selected for processing (2)
  • src/NotificationList/index.tsx
  • tests/stack-hover.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


Walkthrough

NotificationList 在悬停期间监听文档级鼠标移动,并检查事件路径和列表的 :hover 状态。新增测试覆盖 Shadow DOM 移动,以及移除悬停通知后的堆叠和自动关闭恢复。

Changes

通知悬停恢复

Layer / File(s) Summary
悬停状态检测与恢复
src/NotificationList/index.tsx, tests/stack-hover.test.tsx
列表根节点新增引用。悬停期间,文档级 mousemove 处理器根据事件路径和 :hover 状态清除悬停状态。测试覆盖开放和封闭 Shadow DOM,以及移除悬停通知后的堆叠状态和自动关闭行为。

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to d90d3

The hover-recovery change is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed PR 实现了 [#59412] 的修复。src/NotificationList/index.tsx 为悬停列表注册文档级捕获 mousemove 监听器;当事件路径不包含列表且列表不匹配 :hover 时清除 listHovering。该逻辑覆盖移除悬停通知后未触发 mouseleave 的情况。清除状态后,堆叠列表恢复收起状态,通知的 pauseOnHover 计时可以…
Out of Scope Changes check ✅ Passed 变更仅涉及 NotificationList 的悬停恢复逻辑及其自动化测试。测试验证了关联问题所需的堆叠收起、悬停暂停和自动关闭行为。未发现与 [#59412] 无关的代码或测试变更。
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题“fix: recover notification hover after notice removal”准确概括了通知移除后恢复悬停状态这一主要变更,内容清晰且具体。
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

我是小兔,蹦到通知旁,
指针离开,悬停状态退场。
堆叠收拢,计时重新流淌,
一封一封,通知轻轻散场。
月光下,我竖起耳朵鼓掌。

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.22%. Comparing base (dd2ba0b) to head (d90d379).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #413      +/-   ##
==========================================
+ Coverage   99.20%   99.22%   +0.02%     
==========================================
  Files          12       12              
  Lines         376      387      +11     
  Branches      102      104       +2     
==========================================
+ Hits          373      384      +11     
  Misses          3        3              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

点击 Notification 关闭按钮后,通知未关闭且保持 hover 展开状态

1 participant