Skip to content

refactor(core)!: drop SortableJS dependency - #2634

Merged
ghiscoding merged 38 commits into
masterfrom
refactor/drop-sortablejs
Oct 9, 2026
Merged

ghiscoding merged 38 commits into
masterfrom
refactor/drop-sortablejs

Conversation

@ghiscoding

@ghiscoding ghiscoding commented Jun 30, 2026 •

Copy link
Copy Markdown
Owner

vibe coded with mostly copilot Claude Sonnet 4.6

I first tried to migrate from SortableJS to @formkit/drag-and-drop in another branch refactor/formkit-dnd but copilot suggested to actually drop the use of any external dependency and just use native code by adding about ~350 loc now ~440 loc after all fixes. Note that this wouldn't get merged until the next major version (next year) since that could impact some E2E tests (I had to add a custom Cypress drag command to make my E2E tests pass) and some small UI differences too (e.g. no more drag animation)

Comparing the build size of my Salesforce standalone script zip file, dropping SortableJS drops the file size by about 10Kb ~9Kb (as a comparison, when I tried to migrate to @formkit/drag-and-drop, that only dropped by about ~2.5Kb, and there's still some touch issues with that approach/branch, so dropping SortableJS entirely and going native has a much larger impact for the decrease in size).

@ghiscoding
ghiscoding marked this pull request as draft June 30, 2026 22:38
@codecov

codecov Bot commented Jun 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.0%. Comparing base (be036fb) to head (72eeedf).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #2634    +/-   ##
========================================
  Coverage   100.0%   100.0%            
========================================
  Files         201      202     +1     
  Lines       27058    27472   +414     
  Branches     9483     9588   +105     
========================================
+ Hits        27058    27472   +414     
Flag Coverage Δ
angular 100.0% <ø> (ø)
universal 100.0% <100.0%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ghiscoding

ghiscoding commented Jun 30, 2026 •

Copy link
Copy Markdown
Owner Author

converting to Draft since I mainly want to see if all tests are passing, if confirmed then I'll probably close the branch and just resurrect it in our next major version in 2027-Q1. I mainly wanted to use my leftover copilot tokens before the next month rolls in

cc @zewa666

EDIT

After trying it on my linux laptop, I had to patch a few things for Firefox Linux, and also told the AI to patch for any Safari issues as well. Now it's still shaving 10Kb from my zip file but it's now increased from 100 loc to 350 loc (as per codecov), probably still worth it but quite different compared to the original AI assumption 🤔

EDIT 2

hmm I found some more issues with touch not working, and some issues with Firefox Linux, it works fine with touch with SortableJS though....

EDIT 3

hmm ok I think I managed to fix all issues, in the end it's decreasing my zip by ~9Kb now, which is probably still worth it, considering that it's a lighter approach (SortableJS was created when ES6/HTML5 just came out), but I would certainly hold on this until our next major release. It could be good to get feedback on the matter. Only thing I couldn't try is Safari/MacOS but I did ask the AI to cover it too and it's also missing animation when dragging but that is barely noticeable

Cheers

@pkg-pr-new

pkg-pr-new Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
angular-slickgrid

npm i https://pkg.pr.new/angular-slickgrid@2634

aurelia-slickgrid

npm i https://pkg.pr.new/aurelia-slickgrid@2634

slickgrid-react

npm i https://pkg.pr.new/slickgrid-react@2634

slickgrid-vue

npm i https://pkg.pr.new/slickgrid-vue@2634

@slickgrid-universal/angular-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/angular-row-detail-plugin@2634

@slickgrid-universal/aurelia-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/aurelia-row-detail-plugin@2634

@slickgrid-universal/react-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/react-row-detail-plugin@2634

@slickgrid-universal/vue-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/vue-row-detail-plugin@2634

@slickgrid-universal/binding

npm i https://pkg.pr.new/@slickgrid-universal/binding@2634

@slickgrid-universal/common

npm i https://pkg.pr.new/@slickgrid-universal/common@2634

@slickgrid-universal/composite-editor-component

npm i https://pkg.pr.new/@slickgrid-universal/composite-editor-component@2634

@slickgrid-universal/custom-footer-component

npm i https://pkg.pr.new/@slickgrid-universal/custom-footer-component@2634

@slickgrid-universal/custom-tooltip-plugin

npm i https://pkg.pr.new/@slickgrid-universal/custom-tooltip-plugin@2634

@slickgrid-universal/empty-warning-component

npm i https://pkg.pr.new/@slickgrid-universal/empty-warning-component@2634

@slickgrid-universal/event-pub-sub

npm i https://pkg.pr.new/@slickgrid-universal/event-pub-sub@2634

@slickgrid-universal/excel-export

npm i https://pkg.pr.new/@slickgrid-universal/excel-export@2634

@slickgrid-universal/graphql

npm i https://pkg.pr.new/@slickgrid-universal/graphql@2634

@slickgrid-universal/odata

npm i https://pkg.pr.new/@slickgrid-universal/odata@2634

@slickgrid-universal/pagination-component

npm i https://pkg.pr.new/@slickgrid-universal/pagination-component@2634

@slickgrid-universal/pdf-export

npm i https://pkg.pr.new/@slickgrid-universal/pdf-export@2634

@slickgrid-universal/row-detail-view-plugin

npm i https://pkg.pr.new/@slickgrid-universal/row-detail-view-plugin@2634

@slickgrid-universal/rxjs-observable

npm i https://pkg.pr.new/@slickgrid-universal/rxjs-observable@2634

@slickgrid-universal/sql

npm i https://pkg.pr.new/@slickgrid-universal/sql@2634

@slickgrid-universal/text-export

npm i https://pkg.pr.new/@slickgrid-universal/text-export@2634

@slickgrid-universal/utils

npm i https://pkg.pr.new/@slickgrid-universal/utils@2634

@slickgrid-universal/vanilla-bundle

npm i https://pkg.pr.new/@slickgrid-universal/vanilla-bundle@2634

@slickgrid-universal/vanilla-force-bundle

npm i https://pkg.pr.new/@slickgrid-universal/vanilla-force-bundle@2634

@slickgrid-universal/web-mcp

npm i https://pkg.pr.new/@slickgrid-universal/web-mcp@2634

commit: 72eeedf

@ghiscoding ghiscoding changed the title refactor!: drop SortableJS dependency refactor(core)!: drop SortableJS dependency Jul 7, 2026
6pac-ai added a commit to 6pac/SlickGrid that referenced this pull request Oct 5, 2026
Final part of the SortableJS removal (port of ghiscoding/slickgrid-universal#2634).
Column reordering and draggable grouping now run on the built-in native HTML5
drag & drop engines in slick.interactions.js; the project has zero runtime
dependencies.

- package.json: remove the `dependencies` block (sortablejs was the only entry);
  package-lock.json drops the root and vite-demo sortablejs entries (a transitive
  sortablejs entry remains only through vite-demo's dependency on the published
  slickgrid@5.x package and will disappear on the next release)
- remove the SortableJS `<script>` tags (CDN + local fallback) from 107 example pages
  and 5 test pages, including the pages added since this change was first written
  (auto header height, variable row height, quirk repro pages, and the RTL example's
  sortablejs-rtl fork, which the RTL-aware native engine replaces); delete
  examples/sortable-cdn-fallback.js
- example-external-headersort.html keeps its SortableJS tag: it demonstrates an
  external library plugged in through the `enableColumnReorder` hook and calls
  `Sortable.create()` itself
- quirk-sticky-column-reorder.cy.ts: its harness no longer loads sortablejs
- src/global.d.ts: drop the `Sortable` global declaration and its type import
- eslint.config.mjs: drop the `Sortable` global
- vite-demo: remove the sortablejs dependency and the `window.Sortable` shim
- scripts/builds.mjs: remove a stale SortableJS-related comment
- README: the SortableJS requirement note and the Dependency section become a
  zero-runtime-dependencies note (historical v3 jQueryUI->SortableJS references are
  left as history)
- docs/in-depth/migration-v6.md: list the changed getSetupColumnReorder() return value
- the `.slick-sortable-placeholder` / `.slick-droppable-sortitem-hover` CSS
  class names are intentionally kept so consumers' custom CSS keeps working

BREAKING CHANGE: SortableJS is no longer used nor required. Consumers who load
SlickGrid via script tags can remove their SortableJS `<script>` include; the
`window.Sortable` global is no longer read. Column reordering now requires
`slick.interactions.js` to be loaded (it already was in every example). The
`SlickDraggableGrouping.getSetupColumnReorder()` return shape changed in the
previous commit as part of the same effort.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6pac pushed a commit to 6pac/SlickGrid that referenced this pull request Oct 6, 2026
…drop) (#1243)

Part 3 of the SortableJS removal (port of ghiscoding/slickgrid-universal#2634).
The SlickDraggableGrouping plugin now runs entirely on the native drag engines;
nothing in src/ uses SortableJS anymore (the dependency itself is removed in the
next and final part).

- add `setupDropzonePillDrag()` to slick.interactions.ts: native pill reordering
  inside the grouping dropzone (RTL-aware), column-header drop acceptance via the
  dataTransfer column id, with Firefox/Linux mouse and touch fallbacks
- rewire slick.draggablegrouping.ts: `getSetupColumnReorder()` runs
  `setupColumnReorderDrag` on the header row or on each docking region, auto-scrolls
  the docking scrollbar when the grid has one, and applies the drag with
  `reconcileColumnOrder()`; the dropzone uses `setupDropzonePillDrag`, and the
  hand-rolled dragover/dragenter/dragleave dropzone listeners fold into engine callbacks
- fix: a header reorder on a grouping page no longer deletes hidden columns from the
  grid (the old toArray() read-back only listed rendered headers); new test in
  example-draggable-grouping.cy.ts
- grouping pills are created with `draggable=true` (required for the native HTML5 pill drag)
- a header drop is handled by both the dropzone's native `drop` and the reorder
  engine's fallback `onDrop` path, deduplicated by handleGroupByDrop's existing
  columnAllowed guard
- BREAKING: `getSetupColumnReorder()` now returns `{ columnReorderDragInstance }`
  (a `{ destroy() }` instance) instead of `{ sortableLeftInstance,
  sortableCenterInstance, sortableRightInstance }`
- behavior deltas: no spurious onColumnsReordered after a grouping drop; grouping
  pages now respect `unorderableColumnCssClass` (the old filter was commented out);
  pill drags only reapply grouping when the order changed

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
6pac-ai added a commit to 6pac/SlickGrid that referenced this pull request Oct 6, 2026
Final part of the SortableJS removal (port of ghiscoding/slickgrid-universal#2634).
Column reordering and draggable grouping now run on the built-in native HTML5
drag & drop engines in slick.interactions.js; the project has zero runtime
dependencies.

- package.json: remove the `dependencies` block (sortablejs was the only entry);
  package-lock.json drops the root and vite-demo sortablejs entries (a transitive
  sortablejs entry remains only through vite-demo's dependency on the published
  slickgrid@5.x package and will disappear on the next release)
- remove the SortableJS `<script>` tags (CDN + local fallback) from 107 example pages
  and 5 test pages, including the pages added since this change was first written
  (auto header height, variable row height, quirk repro pages, and the RTL example's
  sortablejs-rtl fork, which the RTL-aware native engine replaces); delete
  examples/sortable-cdn-fallback.js
- example-external-headersort.html keeps its SortableJS tag: it demonstrates an
  external library plugged in through the `enableColumnReorder` hook and calls
  `Sortable.create()` itself
- quirk-sticky-column-reorder.cy.ts: its harness no longer loads sortablejs
- src/global.d.ts: drop the `Sortable` global declaration and its type import
- eslint.config.mjs: drop the `Sortable` global
- vite-demo: remove the sortablejs dependency and the `window.Sortable` shim
- scripts/builds.mjs: remove a stale SortableJS-related comment
- README: the SortableJS requirement note and the Dependency section become a
  zero-runtime-dependencies note (historical v3 jQueryUI->SortableJS references are
  left as history)
- docs/in-depth/migration-v6.md: list the changed getSetupColumnReorder() return value
- the `.slick-sortable-placeholder` / `.slick-droppable-sortitem-hover` CSS
  class names are intentionally kept so consumers' custom CSS keeps working

BREAKING CHANGE: SortableJS is no longer used nor required. Consumers who load
SlickGrid via script tags can remove their SortableJS `<script>` include; the
`window.Sortable` global is no longer read. Column reordering now requires
`slick.interactions.js` to be loaded (it already was in every example). The
`SlickDraggableGrouping.getSetupColumnReorder()` return shape changed in the
previous commit as part of the same effort.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6pac pushed a commit to 6pac/SlickGrid that referenced this pull request Oct 6, 2026
…5 drag & drop for column header reorder (#1242)

* refactor: replace SortableJS with native HTML5 drag & drop for column header reorder

Port of slickgrid-universal's column reorder engine (ghiscoding/slickgrid-universal#2634)
adapted to this repo. The grid no longer needs SortableJS for header column reordering;
the SlickDraggableGrouping plugin still uses it (to be ported next), so the dependency
itself stays for now.

- add `setupColumnReorderDrag()` to slick.interactions.ts: native HTML5 drag with live
  DOM reordering during dragover, browser-edge auto-scroll (10 px every 30 ms, as in
  #1286), Firefox/Linux mouse fallback, touch fallback with a manual drag ghost,
  RTL-aware insertion, and dropzone hooks for draggable grouping
- the engine takes a list of header containers: the header row, or the left, centre and
  right docking regions of a pinned grid. A column only moves within its own container,
  so it never crosses a pinned boundary (the three Sortable lists were unconnected too)
- add `reconcileColumnOrder()`: each reorderable header hands its column slot to the
  header that took its place, so hidden, non-reorderable and other-band columns keep
  their indices whatever the band order in the DOM
- rewire slick.grid.ts: drop the sortablejs type import and the three Sortable
  instances; setupColumnReorder() runs on the engine and reconcileColumnOrder()
- the drag finalizes on `drop` as well as `dragend` (SortableJS finalized on drop;
  without this, drag sources that skip dragend leave the DOM reordered without
  setColumns/onColumnsReordered ever running)
- a hovered header is passed once the pointer is far enough into it for the dragged
  header to land under the pointer: SortableJS's eager swap, without flip-flopping
  between headers of unequal widths. The decision uses the current geometry only, so
  headers that scroll under the pointer during a drag cannot invert it
- the scroll position restored after the reorder is read from the scroller, because the
  drop can be handled before a pending scroll event updates the cached `scrollLeft`
- reword the comment of the hidden-column reorder test (already enabled on next-v6)
- remove a redundant spec-level @4tw/cypress-drag-drop import in example-grid-menu.cy.ts
  that re-registered the plugin's drag command over the shared HTML5 DnD overwrite

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor: drop SortableJS from SlickDraggableGrouping (native drag & drop) (#1243)

Part 3 of the SortableJS removal (port of ghiscoding/slickgrid-universal#2634).
The SlickDraggableGrouping plugin now runs entirely on the native drag engines;
nothing in src/ uses SortableJS anymore (the dependency itself is removed in the
next and final part).

- add `setupDropzonePillDrag()` to slick.interactions.ts: native pill reordering
  inside the grouping dropzone (RTL-aware), column-header drop acceptance via the
  dataTransfer column id, with Firefox/Linux mouse and touch fallbacks
- rewire slick.draggablegrouping.ts: `getSetupColumnReorder()` runs
  `setupColumnReorderDrag` on the header row or on each docking region, auto-scrolls
  the docking scrollbar when the grid has one, and applies the drag with
  `reconcileColumnOrder()`; the dropzone uses `setupDropzonePillDrag`, and the
  hand-rolled dragover/dragenter/dragleave dropzone listeners fold into engine callbacks
- fix: a header reorder on a grouping page no longer deletes hidden columns from the
  grid (the old toArray() read-back only listed rendered headers); new test in
  example-draggable-grouping.cy.ts
- grouping pills are created with `draggable=true` (required for the native HTML5 pill drag)
- a header drop is handled by both the dropzone's native `drop` and the reorder
  engine's fallback `onDrop` path, deduplicated by handleGroupByDrop's existing
  columnAllowed guard
- BREAKING: `getSetupColumnReorder()` now returns `{ columnReorderDragInstance }`
  (a `{ destroy() }` instance) instead of `{ sortableLeftInstance,
  sortableCenterInstance, sortableRightInstance }`
- behavior deltas: no spurious onColumnsReordered after a grouping drop; grouping
  pages now respect `unorderableColumnCssClass` (the old filter was commented out);
  pill drags only reapply grouping when the order changed

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
6pac pushed a commit to 6pac/SlickGrid that referenced this pull request Oct 6, 2026
Final part of the SortableJS removal (port of ghiscoding/slickgrid-universal#2634).
Column reordering and draggable grouping now run on the built-in native HTML5
drag & drop engines in slick.interactions.js; the project has zero runtime
dependencies.

- package.json: remove the `dependencies` block (sortablejs was the only entry);
  package-lock.json drops the root and vite-demo sortablejs entries (a transitive
  sortablejs entry remains only through vite-demo's dependency on the published
  slickgrid@5.x package and will disappear on the next release)
- remove the SortableJS `<script>` tags (CDN + local fallback) from 107 example pages
  and 5 test pages, including the pages added since this change was first written
  (auto header height, variable row height, quirk repro pages, and the RTL example's
  sortablejs-rtl fork, which the RTL-aware native engine replaces); delete
  examples/sortable-cdn-fallback.js
- example-external-headersort.html keeps its SortableJS tag: it demonstrates an
  external library plugged in through the `enableColumnReorder` hook and calls
  `Sortable.create()` itself
- quirk-sticky-column-reorder.cy.ts: its harness no longer loads sortablejs
- src/global.d.ts: drop the `Sortable` global declaration and its type import
- eslint.config.mjs: drop the `Sortable` global
- vite-demo: remove the sortablejs dependency and the `window.Sortable` shim
- scripts/builds.mjs: remove a stale SortableJS-related comment
- README: the SortableJS requirement note and the Dependency section become a
  zero-runtime-dependencies note (historical v3 jQueryUI->SortableJS references are
  left as history)
- docs/in-depth/migration-v6.md: list the changed getSetupColumnReorder() return value
- the `.slick-sortable-placeholder` / `.slick-droppable-sortitem-hover` CSS
  class names are intentionally kept so consumers' custom CSS keeps working

BREAKING CHANGE: SortableJS is no longer used nor required. Consumers who load
SlickGrid via script tags can remove their SortableJS `<script>` include; the
`window.Sortable` global is no longer read. Column reordering now requires
`slick.interactions.js` to be loaded (it already was in every example). The
`SlickDraggableGrouping.getSetupColumnReorder()` return shape changed in the
previous commit as part of the same effort.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6pac pushed a commit to 6pac/SlickGrid that referenced this pull request Oct 6, 2026
Final part of the SortableJS removal (port of ghiscoding/slickgrid-universal#2634).
Column reordering and draggable grouping now run on the built-in native HTML5
drag & drop engines in slick.interactions.js; the project has zero runtime
dependencies.

- package.json: remove the `dependencies` block (sortablejs was the only entry);
  package-lock.json drops the root and vite-demo sortablejs entries (a transitive
  sortablejs entry remains only through vite-demo's dependency on the published
  slickgrid@5.x package and will disappear on the next release)
- remove the SortableJS `<script>` tags (CDN + local fallback) from 107 example pages
  and 5 test pages, including the pages added since this change was first written
  (auto header height, variable row height, quirk repro pages, and the RTL example's
  sortablejs-rtl fork, which the RTL-aware native engine replaces); delete
  examples/sortable-cdn-fallback.js
- example-external-headersort.html keeps its SortableJS tag: it demonstrates an
  external library plugged in through the `enableColumnReorder` hook and calls
  `Sortable.create()` itself
- quirk-sticky-column-reorder.cy.ts: its harness no longer loads sortablejs
- src/global.d.ts: drop the `Sortable` global declaration and its type import
- eslint.config.mjs: drop the `Sortable` global
- vite-demo: remove the sortablejs dependency and the `window.Sortable` shim
- scripts/builds.mjs: remove a stale SortableJS-related comment
- README: the SortableJS requirement note and the Dependency section become a
  zero-runtime-dependencies note (historical v3 jQueryUI->SortableJS references are
  left as history)
- docs/in-depth/migration-v6.md: list the changed getSetupColumnReorder() return value
- the `.slick-sortable-placeholder` / `.slick-droppable-sortitem-hover` CSS
  class names are intentionally kept so consumers' custom CSS keeps working

BREAKING CHANGE: SortableJS is no longer used nor required. Consumers who load
SlickGrid via script tags can remove their SortableJS `<script>` include; the
`window.Sortable` global is no longer read. Column reordering now requires
`slick.interactions.js` to be loaded (it already was in every example). The
`SlickDraggableGrouping.getSetupColumnReorder()` return shape changed in the
previous commit as part of the same effort.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@ghiscoding
ghiscoding marked this pull request as ready for review October 9, 2026 00:51
@ghiscoding
ghiscoding merged commit ba5ab74 into master Oct 9, 2026
23 checks passed
@ghiscoding
ghiscoding deleted the refactor/drop-sortablejs branch October 9, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change ⚠️ major version not supported until next major version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant