listeners from dnd-kit are interfering with the input:checkbox's onChange
event
When I work with input:checkbox onchange
event dnd-kit's {...listeners}
interfere with the onchange event. Listeners disables onchange event in the input (I checked for input:checkbox and input:radio) element. If I remove/disable/commnet-out the {...listeners} input:checkbox event works just fine.
But I need both {...listeners} and onchange event as without {...listeners}
I cannot implement drag and drop.
The code where I tried is given below:
<div
{...attributes}
{...listeners}
ref={setNodeRef}
style={style}
className={styles.itemWrapper}
>
<div
className={styles.item}>
<img src={item.image} alt="Image title goes here..." />
<input type="checkbox" id={item.id.toString()}
onChange={() => {
console.log('checked/unchecked') // doesn't print in console
handleSelection(item.id)
}}
/>
<label htmlFor={item.id.toString()} ></label>
</div>
</div>
** If I disable {...listeners}
onchange event works fine **
<div
{...attributes}
// {...listeners} // disabled
ref={setNodeRef}
style={style}
className={styles.itemWrapper}
>
<div
className={styles.item}>
<img src={item.image} alt="Image title goes here..." />
<input type="checkbox" id={item.id.toString()}
onChange={() => {
console.log('checked/unchecked') // print in console
handleSelection(item.id)
}}
/>
<label htmlFor={item.id.toString()} ></label>
</div>
</div>
<div
{...attributes}
{...listeners}
ref={setNodeRef}
style={style}
className={styles.itemWrapper}
>
<div
className={styles.item}>
<img src={item.image} alt="Image title goes here..." />
<input type="checkbox" id={item.id.toString()}
onChange={() => {
console.log('checked/unchecked') // on change event should work with {...listenters enabled}
handleSelection(item.id)
}}
/>
<label htmlFor={item.id.toString()} ></label>
</div>
</div>