From 9f841695f167aff7718776d1b554915f6a97aa40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Wed, 30 Sep 2026 15:50:19 +0800 Subject: [PATCH] fix: scope notification hover to list content --- src/NotificationList/index.tsx | 12 ++++++------ tests/stack.test.tsx | 9 ++++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/NotificationList/index.tsx b/src/NotificationList/index.tsx index d0ff04b3..62bba2e5 100644 --- a/src/NotificationList/index.tsx +++ b/src/NotificationList/index.tsx @@ -248,12 +248,6 @@ const NotificationList: React.FC = (props) => { [`${listPrefixCls}-hovered`]: listHovering, }, )} - onMouseEnter={() => { - setListHovering(true); - }} - onMouseLeave={() => { - setListHovering(false); - }} style={{ ...styles?.list, ...style }} > = (props) => { className={classNames?.listContent} style={styles?.listContent} ref={contentRef} + onMouseEnter={() => { + setListHovering(true); + }} + onMouseLeave={() => { + setListHovering(false); + }} > { it('support stack', () => { @@ -41,6 +41,9 @@ describe('stack', () => { expect(document.querySelector('.rc-notification-stack-expanded')).toBeFalsy(); fireEvent.mouseEnter(document.querySelector('.rc-notification-list')); + expect(document.querySelector('.rc-notification-stack-expanded')).toBeFalsy(); + + fireEvent.mouseEnter(document.querySelector('.rc-notification-list-content')); expect(document.querySelector('.rc-notification-stack-expanded')).toBeTruthy(); }); @@ -74,14 +77,14 @@ describe('stack', () => { expect(document.querySelector('.rc-notification-stack')).toBeTruthy(); expect(document.querySelector('.rc-notification-stack-expanded')).toBeFalsy(); - fireEvent.mouseEnter(document.querySelector('.rc-notification-list')); + fireEvent.mouseEnter(document.querySelector('.rc-notification-list-content')); expect(document.querySelector('.rc-notification-stack-expanded')).toBeTruthy(); fireEvent.click(document.querySelector('.rc-notification-notice-close')); expect(document.querySelectorAll('.rc-notification-notice')).toHaveLength(4); expect(document.querySelector('.rc-notification-stack-expanded')).toBeTruthy(); - fireEvent.mouseLeave(document.querySelector('.rc-notification-list')); + fireEvent.mouseLeave(document.querySelector('.rc-notification-list-content')); expect(document.querySelector('.rc-notification-stack-expanded')).toBeFalsy(); }); });