Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: if form warp drawer, close button will trigger submit #27175

Merged
merged 2 commits into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13138,6 +13138,7 @@ exports[`ConfigProvider components Drawer configProvider 1`] = `
aria-label="Close"
class="config-drawer-close"
style="--scroll-bar:0px"
type="button"
>
<span
aria-label="close"
Expand Down Expand Up @@ -13199,6 +13200,7 @@ exports[`ConfigProvider components Drawer configProvider componentSize large 1`]
aria-label="Close"
class="config-drawer-close"
style="--scroll-bar:0px"
type="button"
>
<span
aria-label="close"
Expand Down Expand Up @@ -13260,6 +13262,7 @@ exports[`ConfigProvider components Drawer configProvider componentSize middle 1`
aria-label="Close"
class="config-drawer-close"
style="--scroll-bar:0px"
type="button"
>
<span
aria-label="close"
Expand Down Expand Up @@ -13321,6 +13324,7 @@ exports[`ConfigProvider components Drawer configProvider virtual and dropdownMat
aria-label="Close"
class="ant-drawer-close"
style="--scroll-bar:0px"
type="button"
>
<span
aria-label="close"
Expand Down Expand Up @@ -13382,6 +13386,7 @@ exports[`ConfigProvider components Drawer normal 1`] = `
aria-label="Close"
class="ant-drawer-close"
style="--scroll-bar:0px"
type="button"
>
<span
aria-label="close"
Expand Down Expand Up @@ -13443,6 +13448,7 @@ exports[`ConfigProvider components Drawer prefixCls 1`] = `
aria-label="Close"
class="prefix-Drawer-close"
style="--scroll-bar:0px"
type="button"
>
<span
aria-label="close"
Expand Down
9 changes: 9 additions & 0 deletions components/drawer/__tests__/__snapshots__/Drawer.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ exports[`Drawer className is test_drawer 1`] = `
aria-label="Close"
class="ant-drawer-close"
style="--scroll-bar:0px"
type="button"
>
<span
aria-label="close"
Expand Down Expand Up @@ -126,6 +127,7 @@ exports[`Drawer destroyOnClose is true 1`] = `
aria-label="Close"
class="ant-drawer-close"
style="--scroll-bar:0px"
type="button"
>
<span
aria-label="close"
Expand Down Expand Up @@ -192,6 +194,7 @@ exports[`Drawer getContainer return undefined 2`] = `
aria-label="Close"
class="ant-drawer-close"
style="--scroll-bar: 0px;"
type="button"
>
<span
aria-label="close"
Expand Down Expand Up @@ -256,6 +259,7 @@ exports[`Drawer have a footer 1`] = `
aria-label="Close"
class="ant-drawer-close"
style="--scroll-bar:0px"
type="button"
>
<span
aria-label="close"
Expand Down Expand Up @@ -329,6 +333,7 @@ exports[`Drawer have a title 1`] = `
aria-label="Close"
class="ant-drawer-close"
style="--scroll-bar:0px"
type="button"
>
<span
aria-label="close"
Expand Down Expand Up @@ -392,6 +397,7 @@ exports[`Drawer render correctly 1`] = `
aria-label="Close"
class="ant-drawer-close"
style="--scroll-bar:0px"
type="button"
>
<span
aria-label="close"
Expand Down Expand Up @@ -455,6 +461,7 @@ exports[`Drawer render top drawer 1`] = `
aria-label="Close"
class="ant-drawer-close"
style="--scroll-bar:0px"
type="button"
>
<span
aria-label="close"
Expand Down Expand Up @@ -523,6 +530,7 @@ exports[`Drawer style/drawerStyle/headerStyle/bodyStyle should work 1`] = `
aria-label="Close"
class="ant-drawer-close"
style="--scroll-bar:0px"
type="button"
>
<span
aria-label="close"
Expand Down Expand Up @@ -587,6 +595,7 @@ exports[`Drawer support closeIcon 1`] = `
aria-label="Close"
class="ant-drawer-close"
style="--scroll-bar:0px"
type="button"
>
<span>
close
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ exports[`Drawer render correctly 1`] = `
aria-label="Close"
class="ant-drawer-close"
style="--scroll-bar: 0px;"
type="button"
>
<span
aria-label="close"
Expand Down
2 changes: 1 addition & 1 deletion components/drawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ class Drawer extends React.Component<DrawerProps & ConfigConsumerProps, IDrawerS
const { closable, closeIcon = <CloseOutlined />, prefixCls, onClose } = this.props;
return (
closable && (
// eslint-disable-next-line react/button-has-type
<button
type="button"
onClick={onClose}
aria-label="Close"
className={`${prefixCls}-close`}
Expand Down