Skip to content

Drag-and-drop reordering in the QTI choice and ordering editors - #6109

Open
rtibblesbot wants to merge 4 commits into
learningequality:unstablefrom
rtibblesbot:issue-6106-95187d
Open

Drag-and-drop reordering in the QTI choice and ordering editors#6109
rtibblesbot wants to merge 4 commits into
learningequality:unstablefrom
rtibblesbot:issue-6106-95187d

Conversation

@rtibblesbot

@rtibblesbot rtibblesbot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Reordering a choice or ordering row took one chevron click per position, from a toolbar at the row's end. Both editors now reorder by dragging a handle at the row's start, backed by a copy of Kolibri's draggable package as shared/views/dragSort/. Delete stays as its own icon button at the end, so neither editor uses CollapsibleToolbar.

The copy keeps Kolibri's filenames and layout so it stays diffable; the only edits swap in Studio's i18n, strings and logging.

References

Fixes #6106. Source: learningequality/kolibri packages/kolibri-common/components/draggable/ at e5eb4ddbcc85e61ec03075e1a7b7d477455c182c.

Reviewer guidance

Open a channel for editing, go to /channels/<channel_id>/#/qti-demo. Questions 1-2 use the choice editor, question 6 the ordering editor.

  1. Drag a row by its grip — the list settles there, badges renumber, and the row does not open for editing.
  2. Tab to a grip — chevrons replace it. Move the row; focus follows it. First row has no move-up, last no move-down.
  3. With a screen reader, move a row — "Choice 2 moved to position 3 of 4".
  4. Switch to Arabic, repeat step 1 — grip at the right edge, delete at the left.

Worth questioning:

  • The grip has no label of its own; the accessible name comes from DragSortWidget's two move buttons, as in Kolibri. Labelling both announces the affordance twice.
  • shared/views/dragSort/__tests__/ uses @vue/test-utils, deprecated per AGENTS.md. Copied with the package, and the only cover over the SortableJS reconciliation.
  • The demo page does not persist, so reorder-then-reload is unexercised. setChoiceOrder/setItemOrder are asserted to emit bodyXml byte-identical to the equivalent chevron move.

Screenshots

Editor Before After
Choice Choice before Choice after
Ordering Ordering before Ordering after
Choice, RTL Choice RTL
Choice editor Ordering editor

axe-core AA reports one violation with both editors open: contrast on the untouched AddListItemButton.

AI usage

Used Claude Code to port the package, wire both editors, and write the tests. Verified with the Jest suite, pre-commit run --all-files, a file-for-file diff against Kolibri, and browser QA of drag, keyboard move, announcement and RTL.


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks
@rtibblesbot

🟡 Waiting for feedback

Last updated: 2026-08-26 22:43 UTC

rtibblesbot and others added 2 commits August 26, 2026 14:01
From learningequality/kolibri packages/kolibri-common/components/draggable
at e5eb4ddbcc85e61ec03075e1a7b7d477455c182c. Filenames and layout kept so the
copy stays diffable against the source.

Deviations, all module swaps:
- dragSortStrings.js: createTranslator from shared/i18n
- renderSlotRoot.js: shared/logging, which exposes only error()
- DragSortWidget/index.vue: shared/strings/commonStrings, shared/i18n

The four direction labels are copied verbatim from Kolibri's
commonCoreStrings so both stay translatable in step.

shared/views/draggable/ is Studio's older, unrelated system and shares three
filenames with this package — hence the separate directory.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
DraggableRegion emits the whole reordered array; the editors reduce it to an
id order so no readonly state proxy travels back into the composable and the
reorder stays expressible as a permutation of what already exists.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@rtibblesbot
rtibblesbot force-pushed the issue-6106-95187d branch 2 times, most recently from 9417a85 to 2665786 Compare August 26, 2026 21:45
@rtibblesbot
rtibblesbot marked this pull request as ready for review August 26, 2026 21:55
@rtibblesbot
rtibblesbot force-pushed the issue-6106-95187d branch 2 times, most recently from d120098 to c1ce11d Compare August 26, 2026 22:30
rtibblesbot and others added 2 commits August 26, 2026 15:42
The move-up/move-down chevrons go; DragSortWidget's own move buttons, revealed
when the handle takes focus, keep reordering keyboard-operable. Delete becomes
a standalone icon button, so the row no longer needs CollapsibleToolbar.

DraggableRegion is keyed on the select mode: single-select renders the list as
a KRadioButtonGroup and multi-select as a plain div, and SortableJS binds to
that element once, on mount.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Same shape as the choice editor: drag handle at the start of the row,
DragSortWidget's move buttons for the keyboard, delete as a standalone icon
button in place of CollapsibleToolbar.

windowIsSmall was read only by the toolbar's collapse rule, so
useKResponsiveWindow goes with it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@AlexVelezLl

Copy link
Copy Markdown
Member

@rtibblesbot, from the screenshots you added, I can see the drag handler icon is not properly vertically aligned with the radio button and the remove button

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[QTI] Replace the reorder chevrons with drag and drop in the choice and ordering interaction editors

2 participants