# Code maintenance DREAM-790 - Migrate user attributes and their sections to sortable-lists

Project: Stream Design System
Status: closed
URL: https://community.openproject.org/work_packages/DREAM-790

## OPEN POINTS

_No work packages_

## Subtasks

| ID | Subject | Type | Status | Assignee | Project | Target versions |
| --- | --- | --- | --- | --- | --- | --- |
| DREAM-1091 | Do not show "move to sections" entries on the first-level menu | Bug | in development | Lars Wassermann | Stream Design System | 18.1.0 |

## Details

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Designer |  |
| Developers | Lars Wassermann |
| Requires doc change | No |
| Date |  |
| Priority | Medium |
| Target versions | 18.0.0 |
| Sprint |  |
| Backlog bucket |  |
| Module | Frontend components and Primer design system |
| Accessibility | Yes |
| List | a11y report 2026 |
| Labels |  |

## Estimates and progress

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

## Description

## What to build

Migrate the complete user-attributes administration screen to the shared `sortable-lists` suite: section ordering, user custom fields, and built-in user attributes.

Reorder whole sections using the scoped `acts_as_list` move-after helper. Reorder fields within a section and move them between sections, including empty destinations, using the array-order insert-after-key helper established by [DREAM-786](https://community.openproject.org/wp/DREAM-786). Built-in attributes retain stable item keys.

The destination travels as `list_id`; the ordering coordinate is `prev_id`. Morph the sections index after a section move and the affected old/new section boundaries after an attribute move, so canonical order, menus, and empty states reconcile.

Use [DREAM-775](https://community.openproject.org/wp/DREAM-775) for directional move items and client-side availability. Section and attribute dragging share the same screen and nested components; migrate their controller wiring and move menus together in one PR for this work package.

Port the section components to `OpenProject::Common::BorderBoxListComponent` in the same PR, so section and field rows get the shared list's drag styling — the suite's row-level styles are scoped to `.op-border-box-list`. Wire the sortable data by hand, as elsewhere; the declarative component API is <mention class="mention" data-id="DREAM-805" data-type="work_package" data-text="#DREAM-805">#DREAM-805</mention>, decoupled. Group-level styling for whole sections arrives separately with <mention class="mention" data-id="DREAM-878" data-type="work_package" data-text="#DREAM-878">#DREAM-878</mention>.

## Acceptance criteria

- [x] Whole user custom field sections reorder through drag and directional menu actions.
- [x] Section moves preserve each section's field membership and internal attribute order.
- [x] User custom fields reorder within their current section and move between sections, including into an empty section.
- [x] Built-in attributes reorder and move between permitted sections using stable item keys.
- [x] Malformed, unknown, out-of-scope, and self-referencing anchors return 422 without partially changing section order, field membership, or attribute order; valid top moves follow the shared contract.
- [x] Cross-section movement and array-order persistence are transactional.
- [x] Section-index and affected old/new section boundaries morph as needed. Both section and attribute dragging remain usable after reconciliation, without confusing nested drop targets.
- [x] Directional menu moves and drag moves use the same relative-anchor persistence path for each item family, with availability reflecting the current order.
- [x] Existing field edit/delete, semantic-key, empty-state, and section-management behavior remains functional.
- [x] Legacy drag-controller wiring, absolute position parameters, and superseded directional persistence paths are removed from these consumers.
- [x] Section and field rows render through `BorderBoxListComponent`, so the shared list drag styling (insertion line, dimmed source, destination outline) applies.
- [x] Service/request, component, frontend, and feature tests cover section reordering, same-section and cross-section attribute moves, empty destinations, invalid anchors, menu moves, reload persistence, and repeated moves after morphs.

## Scope boundary

User custom field section reordering moved here from [DREAM-857](https://community.openproject.org/wp/DREAM-857) to keep the complete user-attributes screen under one implementation owner and PR. DREAM-857 now covers only project phase definitions and work package PDF export templates.

Enumeration reordering remains in [DREAM-789](https://community.openproject.org/wp/DREAM-789) / [PR <mention class="mention" data-id="25467" data-type="work_package" data-text="#25467">#25467</mention>](https://github.com/opf/openproject/pull/25467).

### Hints for QA

Please perform a smoke test of the user attributes page, checking that a user is still able to add and remove sections and individual attributes, as well as reorder them by mouse and keyboard.

Moving items by keyboard between sections was not possible before but is possible now. That should be verified 🙂
