kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Swap @shopify/draggable for SortableJS behind DragContainer

Open rtibbles opened this issue 5 months ago • 2 comments

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Replace @shopify/draggable with SortableJS behind the existing DragContainer API.

Complexity: Medium Target branch: develop

Context

  • @shopify/draggable is imported only in DragContainer.vue; nothing else touches the library.
  • Four callsites use DragContainer via @sort (QuestionsAccordion also @dragStart):
    • coach QuestionsAccordion.vue
    • coach LessonSummaryPage/tables/LessonResourcesTable.vue
    • coach CreateExamPage/sidePanels/SectionSidePanel/SectionOrder.vue
    • device RearrangeChannelsPage.vue
  • Shopify CSS to migrate: .draggable-mirror, .draggable-source--is-dragging, .draggable-source--placed in DragContainer.vue, plus a /deep/ .draggable-mirror <tr> fix in LessonResourcesTable.vue.
  • Keyboard reordering comes from DragSortWidget, independent of the library.
  • Only RearrangeChannelsPage has a test; it emits events directly, not through the library.
  • Dead code to drop: sortable:moveDown/moveUp listeners bound to undefined methods, the commented-out triggerMouseUpOnESC, the undeclared :noDrag prop on DragSortWidget.

The Change

  • Remove @shopify/draggable from packages/kolibri-common/package.json, add sortablejs.
  • Re-implement DragContainer on SortableJS behind its existing API, so callsites change only their CSS.
  • Add touch support.
  • Migrate the Shopify CSS classes, hand-rolling the --placed bounce (no SortableJS equivalent).

How to Get There

  • Coach → lesson → manage resources → reorder.
  • Coach → quiz → create/edit → question order and section order.
  • Device → channels → rearrange.

Out of Scope

  • The source→zone cross-target abstraction.
  • The DragSortWidget keyboard experience.
  • Callsite behaviour beyond the CSS-class renames.

Acceptance Criteria

  • [ ] @shopify/draggable removed from package.json; sortablejs added.
  • [ ] All four callsites reorder correctly via SortableJS.
  • [ ] Dragging works by touch on tablets.
  • [ ] Keyboard reordering via DragSortWidget still works.
  • [ ] Drag mirror, source-hiding, and drop bounce render as before.
  • [ ] RearrangeChannelsPage test passes.

AI usage

Drafted with Claude Code from a codebase audit of the existing @shopify/draggable usage; I verified the callsites, classes, and test against the code and edited every section.

rtibbles avatar Jun 27 '26 20:06 rtibbles

The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.

rtibblesbot avatar Jul 10 '26 02:07 rtibblesbot

The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.

rtibblesbot avatar Jul 15 '26 01:07 rtibblesbot