Skip to content

Commit 12df0e6

Browse files
authored
fix: prevent notification close buttons from submitting forms (#408)
1 parent 4f26598 commit 12df0e6

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/Notification.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ const Notification = React.forwardRef<HTMLDivElement, NotificationProps>((props,
269269

270270
{mergedClosable && (
271271
<button
272+
type="button"
272273
className={clsx(`${noticePrefixCls}-close`, classNames?.close)}
273274
aria-label="Close"
274275
{...closeBtnAriaProps}

tests/index.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,5 +1333,9 @@ describe('Notification.Basic', () => {
13331333
'aria-label',
13341334
'xxx',
13351335
);
1336+
expect(document.querySelector('button.rc-notification-notice-close')).toHaveAttribute(
1337+
'type',
1338+
'button',
1339+
);
13361340
});
13371341
});

0 commit comments

Comments
 (0)