Skip to content

Commit 999c41a

Browse files
authored
fix: clear button should have type="button" (#83)
1 parent 8e721a0 commit 999c41a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/BaseInput.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const BaseInput = React.forwardRef<HolderRef, BaseInputProps>((props, ref) => {
8181

8282
clearIcon = (
8383
<button
84+
type="button"
8485
onClick={(event) => {
8586
handleReset?.(event);
8687
onClear?.();

tests/__snapshots__/index.test.tsx.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ exports[`Input allowClear should change type when click 1`] = `
117117
>
118118
<button
119119
class="rc-input-clear-icon"
120+
type="button"
120121
>
121122
122123
</button>
@@ -140,6 +141,7 @@ exports[`Input allowClear should change type when click 2`] = `
140141
>
141142
<button
142143
class="rc-input-clear-icon rc-input-clear-icon-hidden"
144+
type="button"
143145
>
144146
145147
</button>
@@ -163,6 +165,7 @@ exports[`Input allowClear should not show icon if defaultValue is undefined or e
163165
>
164166
<button
165167
class="rc-input-clear-icon rc-input-clear-icon-hidden"
168+
type="button"
166169
>
167170
168171
</button>
@@ -186,6 +189,7 @@ exports[`Input allowClear should not show icon if defaultValue is undefined or e
186189
>
187190
<button
188191
class="rc-input-clear-icon rc-input-clear-icon-hidden"
192+
type="button"
189193
>
190194
191195
</button>
@@ -209,6 +213,7 @@ exports[`Input allowClear should not show icon if value is undefined or empty st
209213
>
210214
<button
211215
class="rc-input-clear-icon rc-input-clear-icon-hidden"
216+
type="button"
212217
>
213218
214219
</button>
@@ -232,6 +237,7 @@ exports[`Input allowClear should not show icon if value is undefined or empty st
232237
>
233238
<button
234239
class="rc-input-clear-icon rc-input-clear-icon-hidden"
240+
type="button"
235241
>
236242
237243
</button>

0 commit comments

Comments
 (0)