Skip to content

Commit 24f4e5f

Browse files
authored
fix: assign button type in React Vanilla renderers
Assign button type to all buttons rendered in React Vanilla to avoid accidental submitting of forms.
1 parent 30c1b79 commit 24f4e5f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

packages/vanilla-renderers/src/complex/TableArrayControl.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ class TableArrayControl extends React.Component<
111111
<header>
112112
<label className={labelClass}>{label}</label>
113113
<button
114+
type='button'
114115
className={buttonClass}
115116
onClick={addItem(path, createDefaultValue(schema, rootSchema))}
116117
>
@@ -214,6 +215,7 @@ class TableArrayControl extends React.Component<
214215
</td>
215216
<td>
216217
<button
218+
type='button'
217219
aria-label={translations.removeAriaLabel}
218220
onClick={() => {
219221
if (

packages/vanilla-renderers/src/complex/array/ArrayControlRenderer.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export const ArrayControl = ({
9696
<header>
9797
<label className={labelClass}>{label}</label>
9898
<button
99+
type='button'
99100
className={buttonClassAdd}
100101
onClick={addItem(path, createDefaultValue(schema, rootSchema))}
101102
>
@@ -118,6 +119,7 @@ export const ArrayControl = ({
118119
/>
119120
<div className={childControlsClass}>
120121
<button
122+
type='button'
121123
className={buttonClassUp}
122124
aria-label={translations.upAriaLabel}
123125
onClick={() => {
@@ -127,6 +129,7 @@ export const ArrayControl = ({
127129
{translations.up}
128130
</button>
129131
<button
132+
type='button'
130133
className={buttonClassDown}
131134
aria-label={translations.downAriaLabel}
132135
onClick={() => {
@@ -136,6 +139,7 @@ export const ArrayControl = ({
136139
{translations.down}
137140
</button>
138141
<button
142+
type='button'
139143
className={buttonClassDelete}
140144
aria-label={translations.removeAriaLabel}
141145
onClick={() => {

0 commit comments

Comments
 (0)