# Code maintenance DREAM-671 - Migrate generic-drag-and-drop-controller usages to Sortable Lists/Pragmatic DnD

Project: Stream Design System
Status: in development
URL: https://community.openproject.org/work_packages/DREAM-671

## OPEN POINTS

_No work packages_

## Subtasks

| ID | Subject | Type | Status | Assignee | Project | Target versions |
| --- | --- | --- | --- | --- | --- | --- |
| DREAM-786 | Extend sortable-lists for admin surfaces and migrate project attributes | Code maintenance | closed |  | Stream Design System | 17.8.0 |
| DREAM-1015 | Sortable Lists Drag handle alignment | Bug | closed |  | Stream Design System | 18.0.0 |
| DREAM-859 | Migrate form configuration sorting to sortable-lists | Code maintenance | closed |  | Stream Design System | 18.0.0 |
| DREAM-857 | Migrate phase definitions and PDF export templates to sortable-lists | Code maintenance | closed |  | Stream Design System | 18.0.0 |
| DREAM-791 | Migrate work package type list ordering to sortable-lists | Code maintenance | closed |  | Stream Design System | 18.0.0 |
| DREAM-790 | Migrate user attributes and their sections to sortable-lists | Code maintenance | closed |  | Stream Design System | 18.0.0 |
| DREAM-789 | Migrate admin enumeration lists to sortable-lists | Code maintenance | closed |  | Stream Design System | 18.0.0 |
| DREAM-774 | Document the sortable-lists DOM contract | Code maintenance | closed |  | Stream Design System | 18.0.0 |
| DREAM-792 | Migrate meeting agenda sorting to sortable-lists | Code maintenance | in review | Alexander Coles | Stream Design System | 18.1.0 |
| DREAM-793 | Migrate resource planner work package sorting to sortable-lists | Code maintenance | in specification | Lars Wassermann | Stream Design System | 18.2.0 |
| DREAM-805 | Declarative sortable-lists wiring for BorderBoxListComponent | Implementation | in specification |  | Stream Design System | Product Backlog |
| DREAM-891 | Share the inline title form between PageHeader and BorderBoxListComponent | Implementation | new |  | Stream Design System |  |
| DREAM-884 | Announce moves into server-sorted sortable lists correctly | Implementation | new |  | Stream Design System |  |
| DREAM-888 | Free-form empty-state content for BorderBoxListComponent | Implementation | in specification |  | Stream Design System |  |
| DREAM-890 | Inline title editing for BorderBoxListComponent headers | Implementation | in development | Alexander Coles | Stream Design System |  |
| DREAM-775 | Share the four-direction move menu descriptor across modules | Implementation | closed |  | Stream Design System |  |

## Details

| Attribute | Value |
| --- | --- |
| Assignee | Lars Wassermann |
| Accountable |  |
| Designer | Julia Racsko |
| Developers | Alexander Coles, Lars Wassermann |
| Requires doc change | No |
| Date |  |
| Priority | Medium |
| Target versions | 18.2.0 |
| Sprint |  |
| Backlog bucket |  |
| Module | Frontend components and Primer design system, Modules and project features / Backlogs |
| Accessibility | Yes |
| List |  |
| Labels |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| Work |  |
| Remaining work |  |

## Description

Coordinate the migration of all Dragula-era drag and drop to the shared Stimulus `sortable-lists` suite on Atlassian Pragmatic Drag and Drop: the consumers of `generic-drag-and-drop.controller.ts` and the independent Dragula and native implementations alike. Documented exceptions are allowed, but they are written down (see <mention class="mention" data-id="DREAM-785" data-type="work_package" data-text="#DREAM-785">#DREAM-785</mention>).

Implementation is split into work packages so each surface can be reviewed and verified independently. This parent owns the shared contract, coordination, and final removal gate. Use the child work packages and relations for the current work breakdown and progress.

### Decided contract

#### Move request

The shared request uses:

  - `list_type` — sortable item/list family.
  - `list_id` — destination list, including empty destinations; absent/empty for unscoped lists.
  - `prev_id` — relative ordering coordinate.

For complete lists, `nil` or an empty-string predecessor means move to the top. The strict anchor contract accepts positive canonical integer IDs and rejects malformed, unknown, out-of-scope, and self-referencing anchors with 422 and no mutation. Destination changes and reorder persistence are transactional.

Paginated statuses retain the adapter from [AUTOWORK-285](https://community.openproject.org/wp/AUTOWORK-285): an empty predecessor means the start of the requested page, while explicit anchors are validated against global status order. Paginated type-list ordering in [DREAM-791](https://community.openproject.org/wp/DREAM-791) follows the same page-start adapter within the type move scope.

Backlogs ordering alignment is tracked separately in [AGILE-370](https://community.openproject.org/wp/AGILE-370).

#### Response policy

The suite places rows optimistically in the DOM. The admin/settings migrations coordinated here reconcile canonical order through their existing update/replace component streams with `method="morph"`.

Backlogs explicitly opts into the event-only success response from [AGILE-322](https://community.openproject.org/wp/AGILE-322): a Turbo stream carrying `WORK_PACKAGE_MOVED_EVENT`. A bare 204 cannot carry that event; see [PR <mention class="mention" data-id="24157" data-type="work_package" data-text="#24157">#24157</mention>](https://github.com/opf/openproject/pull/24157). The suite sends `optimistic=true` only when the event-only response contract is selected.

#### Shared ordering families

  - `acts_as_list` consumers use a strict scoped move-after helper.
  - Array-backed orders use a shared insert-after-key helper.
  - Resource Planner adapts its custom repack operation to `prev_id`.

#### Move menus

Where loaded rows represent the full move scope, use the shared top/up/down/bottom descriptor from [DREAM-775](https://community.openproject.org/wp/DREAM-775). Client-side availability gating resolves an anchor, and menu moves use the same persistence request as dragging.

Paginated statuses remain an exception: server-backed directional menus move across page boundaries, and filtering disables reordering. Preserve this behavior from [AUTOWORK-285](https://community.openproject.org/wp/AUTOWORK-285) / [PR <mention class="mention" data-id="25223" data-type="work_package" data-text="#25223">#25223</mention>](https://github.com/opf/openproject/pull/25223). [DREAM-791](https://community.openproject.org/wp/DREAM-791) adopts the same server-backed cross-page menu exception for type ordering: dragging stays within the visible page, menu directions address the complete order, and responses retain the current page with feedback.

### Coordination and scope boundaries

  - [DREAM-791](https://community.openproject.org/wp/DREAM-791) owns work package type-list ordering. [DREAM-859](https://community.openproject.org/wp/DREAM-859) owns form configuration groups, attribute rows, and inactive attributes, including edit confirmation and removal of the specialized Dragula controllers. [DREAM-792](https://community.openproject.org/wp/DREAM-792) owns meeting agenda sorting, the last `generic-drag-and-drop` consumer besides the form editor. These are independent consumer migrations, each with its own PR; all three are required for this parent's completion.
  - [DREAM-789](https://community.openproject.org/wp/DREAM-789) now covers only priorities, time-tracking activities, and document types, matching [PR <mention class="mention" data-id="25467" data-type="work_package" data-text="#25467">#25467</mention>](https://github.com/opf/openproject/pull/25467). [DREAM-790](https://community.openproject.org/wp/DREAM-790) owns the complete user-attributes screen: section reordering, user custom fields, and built-in attributes. [DREAM-857](https://community.openproject.org/wp/DREAM-857) owns project phase definitions and work package PDF export templates.
  - [AUTOWORK-285](https://community.openproject.org/wp/AUTOWORK-285) is complete and [PR <mention class="mention" data-id="25223" data-type="work_package" data-text="#25223">#25223</mention>](https://github.com/opf/openproject/pull/25223) is merged. [DREAM-839](https://community.openproject.org/wp/DREAM-839) is also closed; do not treat it as an outstanding status-table migration prerequisite.
  - [DREAM-838](https://community.openproject.org/wp/DREAM-838) owns documented and tested BorderBoxTable integration, building on the tag-independent row handling from [DREAM-786](https://community.openproject.org/wp/DREAM-786) and existing component hooks. Coordinate its shared support with table consumers; Resource Planner persistence and consumer migration remain in [DREAM-793](https://community.openproject.org/wp/DREAM-793).
  - [DREAM-837](https://community.openproject.org/wp/DREAM-837) coordinates semantic-table presentation work. [DREAM-840](https://community.openproject.org/wp/DREAM-840) / [PR <mention class="mention" data-id="25468" data-type="work_package" data-text="#25468">#25468</mention>](https://github.com/opf/openproject/pull/25468) follows the enumeration migration for document-type table presentation. These presentation follow-ups do not independently block legacy-controller removal once their drag consumers are migrated.

Keep dependency ordering in work-package relations rather than duplicating a child list or dated progress summary here. The user-attributes migration in DREAM-790 and the phase-definition/PDF-template migration in DREAM-857 are both part of this parent's completion gate.

### Design background

[PR <mention class="mention" data-id="23893" data-type="work_package" data-text="#23893">#23893</mention>](https://github.com/opf/openproject/pull/23893) explored the Project attributes migration. [DREAM-786](https://community.openproject.org/wp/DREAM-786) retained its multi-type list contract, per-type move-URL resolution, leaf-scoped acceptance, and the migration itself. The experimental absolute-position wire was discarded; new consumers use relative anchors.

### Acceptance criteria

- [ ] All related consumer migrations, shared contract documentation, move-menu integration, and shared table integration are complete, including the user-attributes screen in DREAM-790 and phase definitions/PDF export templates in DREAM-857.
- [ ] Every former shared-controller consumer uses `sortable-lists` and the decided relative-anchor contract.
- [ ] The admin/settings migrations reconcile through morphing their existing component response boundaries.
- [ ] Menu and drag moves share one persistence path where loaded-row anchors express the full move scope; paginated statuses and work package types retain the documented cross-page exception.
- [ ] `generic-drag-and-drop.controller.ts`, its tests, dead position-mode behavior, Angular-service bridge, and consumer wiring are removed.
- [ ] `data-target-container-accessor` is removed from migrated consumers.
- [ ] No meetings-specific or form-configuration-specific Dragula escape hatch remains.
- [ ] A final inventory confirms no remaining reference to the shared controller.

### Out of scope

  - Display-only table migrations and presentation-only follow-ups coordinated by [DREAM-837](https://community.openproject.org/wp/DREAM-837), once their drag consumers are migrated.
  - Backlogs advanced interactions and its existing event-only response contract.
  - Independent Dragula consumers tracked by [DREAM-785](https://community.openproject.org/wp/DREAM-785) and [DREAM-787](https://community.openproject.org/wp/DREAM-787), and native hierarchy sorting tracked by [DREAM-788](https://community.openproject.org/wp/DREAM-788).
  - Angular surfaces tracked by [DREAM-755](https://community.openproject.org/wp/DREAM-755), [DREAM-756](https://community.openproject.org/wp/DREAM-756) and its children, and [DREAM-761](https://community.openproject.org/wp/DREAM-761).
  - Removal of the Dragula package itself, tracked by [DREAM-762](https://community.openproject.org/wp/DREAM-762).
