Skip to content

Commit

Permalink
fix: clear button should have type="button" (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 authored Nov 30, 2024
1 parent 8e721a0 commit 999c41a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/BaseInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const BaseInput = React.forwardRef<HolderRef, BaseInputProps>((props, ref) => {

clearIcon = (
<button
type="button"
onClick={(event) => {
handleReset?.(event);
onClear?.();
Expand Down
6 changes: 6 additions & 0 deletions tests/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ exports[`Input allowClear should change type when click 1`] = `
>
<button
class="rc-input-clear-icon"
type="button"
>
</button>
Expand All @@ -140,6 +141,7 @@ exports[`Input allowClear should change type when click 2`] = `
>
<button
class="rc-input-clear-icon rc-input-clear-icon-hidden"
type="button"
>
</button>
Expand All @@ -163,6 +165,7 @@ exports[`Input allowClear should not show icon if defaultValue is undefined or e
>
<button
class="rc-input-clear-icon rc-input-clear-icon-hidden"
type="button"
>
</button>
Expand All @@ -186,6 +189,7 @@ exports[`Input allowClear should not show icon if defaultValue is undefined or e
>
<button
class="rc-input-clear-icon rc-input-clear-icon-hidden"
type="button"
>
</button>
Expand All @@ -209,6 +213,7 @@ exports[`Input allowClear should not show icon if value is undefined or empty st
>
<button
class="rc-input-clear-icon rc-input-clear-icon-hidden"
type="button"
>
</button>
Expand All @@ -232,6 +237,7 @@ exports[`Input allowClear should not show icon if value is undefined or empty st
>
<button
class="rc-input-clear-icon rc-input-clear-icon-hidden"
type="button"
>
</button>
Expand Down

0 comments on commit 999c41a

Please sign in to comment.