Skip to content

Commit

Permalink
🐛(react) fix Select submit button
Browse files Browse the repository at this point in the history
As the default type of button is "submit", when including a Select
inside a form, clicking on any of its button was triggering form
submission.
  • Loading branch information
NathanVss committed Feb 12, 2024
1 parent e79768c commit f16eed9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/hungry-knives-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@openfun/cunningham-react": patch
---

fix Select submit button
2 changes: 2 additions & 0 deletions packages/react/src/components/Forms/Select/mono-common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export const SelectMonoAux = ({
e.stopPropagation();
}}
icon={<span className="material-icons">close</span>}
type="button"
/>
<div className="c__select__inner__actions__separator" />
</>
Expand All @@ -164,6 +165,7 @@ export const SelectMonoAux = ({
</span>
}
disabled={disabled}
type="button"
{...downshiftReturn.toggleButtonProps}
/>
</div>
Expand Down
2 changes: 2 additions & 0 deletions packages/react/src/components/Forms/Select/multi-common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export const SelectMultiAux = ({ children, ...props }: SelectMultiAuxProps) => {
props.onSelectedItemsChange([]);
}}
icon={<span className="material-icons">close</span>}
type="button"
/>
<div className="c__select__inner__actions__separator" />
</>
Expand All @@ -143,6 +144,7 @@ export const SelectMultiAux = ({ children, ...props }: SelectMultiAuxProps) => {
</span>
}
disabled={props.disabled}
type="button"
/>
</div>
<div className="c__select__inner__value">
Expand Down

0 comments on commit f16eed9

Please sign in to comment.