transformDraggedElement is called even if morphing is disabled and a bug that has to do with morphing is now fixed (it was moving the element before styling it)
update README to fix global.d.ts example
enhancement: DndEvent now allows the use of generics.
fix: if a drop zone is removed mid-drag it was causing the lib to throw errors
fix: dropdowns (select elements) will now maintain their value during drag
fixed a bug that made dropTargetClasses and dropTarget styles work incorrectly when applied to nested zones
made the aria support more friendly for multi-page apps (ex: SvelteKit) by having the lib lazy init and clean up the aria divs when the last instance is removed
fixed an issue with items sometimes not making way for the dragged element after autoscroll
fixed the typescript type for dropTargetClasses
added a link example for a basic implementation of multi-drag in the README
added a new option, zoneTabIndex
, that allows to set custom tabindex in the list container.
Please do not use. It was deployed with unintended changes
bugfix - works properly when under shadow dom
bugfix - works properly now when dropFromOtherDisabled is set to true while the shadow element is in the zone
added a new option, morphDisabled
, that allows to disable morphing of dragged item.
bug fix - not crashing when a new dnd zone is created mid drag
exporting DRAGGED_ELEMENT_ID
to allow targeting the dragged element and its subtree using CSS or to fetch it with document.getElementById
.
fixed a race condition that could happen under extremely rapid drag-start -> drop while spam-clicking feverishly
exporting SHADOW_PLACEHOLDER_ITEM_ID
for easier filtering in recursive zones use-cases
added the centreDraggedOnCursor
option to deal with zones that have large items (wide, tall or both) in them that can be dragged over much smaller items.
in these cases, having the center of the items (which is the focal point that triggers all dnd events), and the cursor be the same point makes it more intuitive to drag the large items around.
fixed an issue when dragging an item on top of a droppedFromItemsDisabled zone (it is treated as outside of any now, as it should)
fixed a keyboard related bug - it is now possible to tab back to the dragged item after tabbing to external elements mid drag
accessibility features now work when the library is dynamically imported (in other words, keyboard navigation now works in the REPL again).
Made dropTargetClasses
when initiating drag via keyboard.
Added a new option, dropTargetClasses
, that allows adding global classes to a dnd-zone when it is a potential drop target (during drag).
This release introduces a subtle change to the dragStarted event.
If you are using Dragula Copy on Drag, you will need to update your consider handler (add 1 line of code to remove the newly added shadow placeholder, see linked REPL).
Same goes for the crazy nesting example
Starting with this version, the initial consider event (dragStarted) places a placeholder item with a new id instead of the dragged item in the items list (old behaviour: removing the dragged item from the list altogether). The placeholder is replaced with the real shadow element (the one that has the same id as the original item) in the next event (basically instantly).
This change makes the initial behaviour of large items (relative to their peers) much smoother.
All the changes in this release only affect pointer (mouse/ touch) based drag and drop operations. It changes some default behaviours (for the better).
- When an element is being dragged outside of any dnd zone, the placeholder element now appears in the original dnd zone in the original index and indicates where the element would land if dropped. This was added for better UX and to address single sortable list use cases.
- This change includes the introduction of two new triggers, that can be intercepted by the
consider
handler:DRAGGED_LEFT_ALL
which fires when the placeholder is added to the origin dndzone, andDRAGGED_ENTERED_ANOTHER
which fires when the placeholder is removed from the origin dnd zone. - When drag starts - the library now locks the minimum width and height of the origin dropzone for the duration of the drag operation. This is done in order to prevent the container from shrinking and growing jarringly as the element is dragged around. This is especially helpful when the user drags the last element, which in previous versions could make the dndzone shrink underneath such that the dragged element wasn't over it anymore.