You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're using a dndkit within a modal / dialog-like experience. The modal code is from an external component library that we do not control. The modal itself has an onKeyDown listener to prevent keyboard events designed for the modal to bubble up to the main document.
This leads to a problem for dndkit usage as, when using the keyboard, once the drag event has started, the only way for that drag event to end is for the onKeyDown listener attached to the document to be triggered but the modal event listener is preventing that from happening. My belief is that the Modal component is correct in it's behaviour.
I see a few options to address this:
Add/Remove the event listener on the target. This seems to be the most sensible and simple fix, we're in full control of the active node in the sensor and just because the target is being dragged by the keyboard doesn't mean it shouldn't still receive events related to drop.
Adding an option to attach a listener on the parent node of the DndContext. Less reliable as we have no control / awareness of where the element within the user's application.
Adding an option to provide a custom target for the onKeyDown event. Most complex but also allows the user to control exactly where the event is attached.
The text was updated successfully, but these errors were encountered:
Related to #1367
Similar to the suggestion in that issue, we'd need to move a number the KeyboardSensor's methods to protected (attach/dettach/handleStart) in order to have a custom implementation of our own.
We're using a dndkit within a modal / dialog-like experience. The modal code is from an external component library that we do not control. The modal itself has an onKeyDown listener to prevent keyboard events designed for the modal to bubble up to the main document.
This leads to a problem for dndkit usage as, when using the keyboard, once the drag event has started, the only way for that drag event to end is for the onKeyDown listener attached to the document to be triggered but the modal event listener is preventing that from happening. My belief is that the Modal component is correct in it's behaviour.
I see a few options to address this:
The text was updated successfully, but these errors were encountered: