Skip to content

Commit 5337c97

Browse files
author
Clauderic Demers
committed
fix: issue with radio input name collision when cloning helper
1 parent 6378916 commit 5337c97

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/utils.js

+6
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,12 @@ export function cloneNode(node) {
261261
field.value = fields[i].value;
262262
}
263263

264+
// Fixes an issue with original radio buttons losing their value once the
265+
// clone is inserted in the DOM, as radio button `name` attributes must be unique
266+
if (field.type === 'radio' && field.name) {
267+
field.name = `__sortableClone__${field.name}`;
268+
}
269+
264270
if (field.tagName === NodeType.Canvas) {
265271
const destCtx = field.getContext('2d');
266272
destCtx.drawImage(fields[i], 0, 0);

0 commit comments

Comments
 (0)