Skip to content

Commit

Permalink
fix activeElement wrong binding
Browse files Browse the repository at this point in the history
  • Loading branch information
moalamri committed Dec 4, 2024
1 parent eece042 commit c29a310
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/lib/form/Form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@
const field = prepareField(event.item.dataset.type);
const { newIndex } = event;
form.fields = [...form.fields.slice(0, newIndex), field, ...form.fields.slice(newIndex)];
// sleep for 100ms to allow the new field to be added to the DOM
setTimeout(() => {
form.activeElement = field;
}, 100);
form.activeElement = form.fields[newIndex];
},
onRemove(event: SortableEvent) {
const { oldDraggableIndex } = event;
Expand Down

0 comments on commit c29a310

Please sign in to comment.