artisanpack-ui/livewire-drag-and-drop
A Livewire drag-and-drop component from ArtisanPack UI for building sortable lists and moving items between lists without custom JavaScript. It handles reordering and drag events server-side through Livewire, making it easy to add interactive, sortable interfaces to Laravel apps.
Initial assessment for v2.1.0; no prior assessment exists.
Architecture fit: The package is a Laravel/Livewire-oriented drag-and-drop layer built on Alpine.js directives (x-drag-context / x-drag-item) with a rewritten Pointer Events engine. It fits Laravel applications that already use Livewire 3/4 and Alpine, especially admin panels, builders, kanban boards, sortable tables, and any UI needing accessible reordering. The 2.1 additions—connected containers, nested contexts, keyboard moves, lifecycle events, drop rules, optimistic moves with revert, translatable announcements, and styling state attributes—move it from a basic sortable helper toward a fuller interaction framework.
Integration feasibility: Feasible for Livewire/Alpine stacks. The package auto-registers on alpine:init and can also be installed explicitly via Alpine.plugin( LivewireDragAndDrop ). The 2.0 x-drag-context / x-drag-item directives and drag:end → orderedIds flow remain, so most existing markup should survive. The Livewire integration now uses the morphed hook, fixing a 2.0 defect where moved items stayed marked __livewire_ignore and stopped receiving server re-renders. That fix is important for production Livewire usage.
Technical risk: Moderate to high for existing 2.0 consumers because v2.1.0 is a minor release with breaking behavior changes:
document, or Livewire #[On] handlers will silently stop receiving drag events. This is the highest-risk change and requires an audit of every event listener.window.LivewireDragAndDrop is now the plugin function, not a module namespace object. Script-tag consumers using the old shape will break.draggable="true". CSS or JS depending on native DnD behavior will need adjustment.aria-grabbed is no longer set. Accessibility tests or custom styling tied to that attribute may need updating.touchDelay, default 200 ms), which can conflict with mobile scrolling expectations if not tuned.The real-browser keyboard and mouse tests reduce regression risk, but the notes do not claim touch/pen coverage in headless Chrome. Performance characteristics under large lists and deeply nested contexts are also unstated.
Key questions:
#[On]?accepts) purely client-side, and how should server-side authorization interact with them?drag:end/drag:drop plus a Livewire action, with revert(moveId) on failure?Stack fit: Best fit is a Laravel application using Livewire 3 or 4 and Alpine.js for interactive UI. The package should be introduced at the Blade/Alpine layer, with Livewire components owning persistence and server validation. Teams not using Livewire can still use the Alpine plugin or UMD build, but they lose the built-in Livewire morph integration and must handle event wiring manually.
Migration path: Treat this as a controlled minor-version upgrade, not a drop-in patch. Sequence:
docs/upgrading.md and inventory all existing drag listeners. Move any ancestor/document/#[On] listeners onto the x-drag-context element.window.LivewireDragAndDrop shape.draggable="true" and aria-grabbed.morphed hook fix against existing components, especially lists that re-render after a drop.data-drag-group only where cross-container movement is intended; leave ungrouped lists unchanged.Compatibility: The notes explicitly cover Livewire 3 and 4, Alpine plugin registration, and preservation of the 2.0.1 named exports (registerDirectives, registerLivewireHooks). Pointer Events implies modern browser support; older browsers or embedded webviews need explicit validation. PHP/Laravel version constraints are not stated in the release notes and must be confirmed from composer.json.
Sequencing: Start with a development spike on one representative screen. Then migrate event listeners, wire server-side persistence and revert behavior, configure translations and keyboard bindings, and run a browser matrix covering mouse, touch, keyboard, and Livewire re-render scenarios. Roll out to internal users before production, with a feature flag or component-level opt-in if the app has many drag surfaces.
Maintenance: The release workflow—tag-driven tests, npm publish with provenance, GitHub release from changelog, docs import—is a positive maintenance signal. The documentation set is expanding in the right areas. The main maintenance burden is the breaking change surface in a minor release: teams must track event-bubbling changes, UMD global changes, and native DnD removal. The package’s long-term health depends on keeping pace with Livewire and Alpine releases, especially Livewire 4.
Support: Internal support load will concentrate on event wiring and accessibility configuration. The translatable announcements and data-drag-label support are helpful, but product teams still own the actual copy and screen-reader validation. The revert APIs (revert(moveId), revertItem(itemId), $dragRevert) require backend error-handling patterns; without a documented server-side contract, teams may implement inconsistent optimistic UI behavior.
Scaling: Delegated document-level listeners and auto-scroll should be validated against large boards and long lists. Nested contexts are powerful but increase the chance of event leakage if listeners are placed incorrectly. The real-browser test suite is a good regression control, but it does not replace load/performance testing for high item counts. Bundle size and asset-loading strategy should be checked in the Laravel build pipeline.
Failure modes: The most likely production failures are silent: drag events stop firing because listeners remain on ancestors, UMD consumers break on the changed global, or server re-renders overwrite moved items due to improper Livewire integration. Touch drags may interfere with page scroll if touchDelay is too low. Drop-rule callbacks can throw and cancel drops unexpectedly. Revert flows can leave the UI inconsistent if server rejection handling is incomplete. Keyboard focus after Livewire morph is improved, but should still be tested.
Ramp-up: Medium. Teams already comfortable with Livewire and Alpine should adapt quickly; teams treating this as a generic sortable library will need training on lifecycle events, context grouping, drop rules, and optimistic revert. The new docs pages for connected containers, events, configuration, styling, and upgrading are the right onboarding material. A short internal enablement session plus one reference implementation should be sufficient before wider adoption.
How can I help you explore Laravel packages today?