Skip to content

[DREAM-774] Document sortable lists in Lookbook - #25137

Merged
myabc merged 5 commits into
devfrom
implementation/DREAM-774-sortable-lists-docs
Sep 10, 2026
Merged

myabc merged 5 commits into
devfrom
implementation/DREAM-774-sortable-lists-docs

Conversation

@myabc

@myabc myabc commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Note

#21688 (OP-18657) and #25139 (DREAM-821) are not dependencies of this PR and as such there are no links to Stimulus API doc/source code.

Note

This documentation will evolve once #24525 is merged.

Ticket

https://community.openproject.org/wp/DREAM-774

What are you trying to accomplish?

Document how to implement drag and drop with the sortable-lists Stimulus suite, alongside the design guidance for the interaction. This is the documentation that DREAM-786 left to this ticket.

Patterns → Drag and drop brings the design guidance and implementation documentation together on one Lookbook page, with six tabs:

  • Design guidance: anatomy, when to use drag and drop, existing uses, expected behavior, vocabulary and links to Atlassian's design and accessibility guidelines. Still marked as a draft pending design review.
  • Implementation overview: controller roles, topology diagrams and guidance on choosing a scenario.
  • One list, Sibling lists and Nested lists: markup and persistence requirements for each scenario. The single-list and sibling-list tabs include hand-wired previews with positional move menus; destination actions are left to the consumer.
  • API reference: controller attributes, the request and response contract, backend integration, the Angular counterpart and migration guidance.

generic-drag-and-drop and its two subclasses also carry @deprecated TSDoc pointing at sortable-lists. No call sites are migrated here.

Screenshots

N.B. screenshots were made before b6545fe was pushed

Patterns → Drag and drop

Screenshot 2026-09-07 at 17 17 47

Behaviors → Sortable lists

Intro

Intro Diagrams
Sortable Lists - Introduction Sortable Lists - Introduction 2

In depth

One list Sibling lists Nested lists Reference
Sortable Lists - One list Sortable Lists - Sibling lists Sortable Lists - Nested lists Sortable Lists - Reference

What approach did you choose and why?

  • A new Behaviors section holds Stimulus/TypeScript interactivity that is not a ViewComponent. The page directories are numbered so it sorts between Patterns and Styles; page URLs are unchanged.
  • Scenario tabs rather than a layer-by-layer reference, so a reader takes the tab that matches their surface and reads it end to end. Batch selection (AGILE-278, AGILE-361) later lands as a subsection of the sibling lists tab.
  • Samples are plain HTML data-* attributes; the Rails data: hash form is explained once in the Reference tab. The one exception is the move menu, which depends on Primer's ActionMenu and is therefore shown as its with_item call.
  • The previews have no endpoint (client-only mode does not exist), so a drop rolls back with the generic toast. The page says so beside each embed.
  • Diagrams are exports from the Figma topology file rendered at their 1× width so all four share one scale.
  • DREAM-822 (generated Stimulus reference docs) is deliberately not a dependency; the DREAM-805 component API is documented by its own ticket.

Merge checklist

  • Added/updated tests — none; the contract is already asserted by the component specs, sortable-lists.controller.spec.ts and the reorder feature specs
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@myabc
myabc requested a lite review from Copilot September 4, 2026 13:37
@myabc myabc added documentation DO NOT MERGE javascript Pull requests that update Javascript code labels Sep 4, 2026
@myabc myabc added this to the 17.9.x milestone Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Deploying openproject with ⚡ PullPreview

Field Value
Latest commit 5513b07
Job deploy
Status 🗑️ Preview destroyed
Preview URL Destroyed

View logs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new Lookbook guide includes an ambiguous value key name (move_url_templates_value) that is inconsistent with the documented sortable_lists_* data-hash convention and can mislead consumers into wiring the controller incorrectly.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a new Lookbook pattern guide for the sortable-lists Stimulus controller suite and documents migration away from the legacy dragula-based generic-drag-and-drop, while also marking the old controllers as deprecated in-code to discourage new usage.

Changes:

  • Added a comprehensive Lookbook pattern page describing sortable-lists wiring, request/response contract, accessibility move menus, and migration notes.
  • Marked GenericDragAndDropController as deprecated with guidance pointing readers to sortable-lists.
  • Marked existing surfaces inheriting from GenericDragAndDropController as deprecated to prompt future migration.
File summaries
File Description
lookbook/docs/patterns/40-drag-and-drop.md.erb New Lookbook documentation for sortable lists (manual wiring + migration guidance).
frontend/src/stimulus/controllers/dynamic/generic-drag-and-drop.controller.ts Adds @deprecated JSDoc to the legacy dragula-based controller.
frontend/src/stimulus/controllers/dynamic/meetings/drag-and-drop.controller.ts Marks meetings drag-and-drop surface as deprecated due to inheritance.
frontend/src/stimulus/controllers/dynamic/admin/type-form-configuration/drag-and-drop.controller.ts Marks type form configuration drag-and-drop surface as deprecated due to inheritance.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lookbook/docs/patterns/40-drag-and-drop.md.erb Outdated
@myabc
myabc force-pushed the implementation/DREAM-774-sortable-lists-docs branch from 2a9e562 to 9d6e696 Compare September 7, 2026 16:03
@myabc myabc changed the title Implementation/dream 774 sortable lists docs [DREAM-774] Document sortable lists in Lookbook Sep 7, 2026
@myabc myabc removed the DO NOT MERGE label Sep 7, 2026
@myabc
myabc force-pushed the implementation/DREAM-774-sortable-lists-docs branch from 9d6e696 to 87304ac Compare September 7, 2026 16:10
@myabc
myabc requested a lite review from Copilot September 7, 2026 16:25
@myabc
myabc requested review from HDinger and j-racsko September 7, 2026 16:25
@myabc
myabc marked this pull request as ready for review September 7, 2026 16:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The review found concrete documentation issues (incorrect base classes in examples and broken markdown formatting) and the PR’s effective scope appears broader than the described intent, needing clarification.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 13/68 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread lookbook/docs/01-how-to-use.md.erb Outdated
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./spec/features/work_packages/details/inplace_editor/version_editor_spec.rb[1:1:2]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #25137, linked for reference only):

- `rspec ./spec/features/work_packages/details/inplace_editor/version_editor_spec.rb[1:1:2]`

Treat this as a standalone task, unrelated to PR #25137. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #25137 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @myabc to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @myabc, and request a review from @myabc.
On every commit, set @myabc as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

@myabc
myabc requested a review from ulferts September 7, 2026 16:53
Comment thread lookbook/docs/20-patterns/45-drag-and-drop[nested-lists].md.erb
Comment thread lookbook/docs/20-patterns/46-drag-and-drop[api-reference].md.erb
Comment on lines +30 to +32
render(Primer::Box.new(display: :flex, align_items: :center)) do
concat(
render(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HDinger This should become a PlainCard eventually: https://community.openproject.org/wp/DREAM-750

Adds a Behaviors section holding a tabbed sortable lists page (one
list, sibling lists, nested lists, reference) with two hand-wired
previews, and turns the drag and drop pattern page into a short
design-facing draft. Numbers the top-level page directories so the new
section sits between Patterns and Styles; page URLs are unchanged.

https://community.openproject.org/wp/DREAM-774
The dragula-based controller is closed to new consumers, but nothing in
the source said so. The tag points readers at sortable-lists before they
copy a call site.
@myabc
myabc force-pushed the implementation/DREAM-774-sortable-lists-docs branch from 87304ac to 0aa026b Compare September 7, 2026 17:05
Comment thread lookbook/docs/20-patterns/40-drag-and-drop.md.erb Outdated
Comment thread lookbook/docs/20-patterns/40-drag-and-drop.md.erb Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment on lines +78 to +91
* **Sortable list, sortable item, sortable item type**: a list whose order the
server persists, a row that takes part in that order, and the category a
list accepts. A row is an item once it carries
`data-sortable-lists--item-id-value`; that is what counts it and anchors
its neighbors' drops. The `sortable-lists--item` controller on it is what
makes it draggable and gives it a move menu, and `confined` keeps a
draggable item in its own list.
* **Drag source**: the original row while it is being dragged. **Drag
preview**: the copy that follows the pointer.
* **Drop indicator**: the line marking where the row will land, drawn without
reserving space. **Drop container**: the list-level outline shown while a
compatible row hovers a list (`data-drop-container="active"`).
* **Reorder** happens within one list; a **move** changes list. In terms of
the backend request they are identical.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want a diagram here too? - or does Behaviours already cover it?

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./spec/features/roles/report_spec.rb[1:1]
  • rspec ./spec/features/roles/report_spec.rb[1:2]
  • rspec ./spec/features/roles/report_spec.rb[1:3]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #25137, linked for reference only):

- `rspec ./spec/features/roles/report_spec.rb[1:1]`
- `rspec ./spec/features/roles/report_spec.rb[1:2]`
- `rspec ./spec/features/roles/report_spec.rb[1:3]`

Treat this as a standalone task, unrelated to PR #25137. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #25137 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @myabc to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @myabc, and request a review from @myabc.
On every commit, set @myabc as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

@HDinger HDinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the images a lot, thanks for spending the effort 🙇
I think the biggest remark for me is the overall structure.. Thinking about how to make it easier for other devs to discover all of that, I think this can be improved. See especially this remark.

@@ -0,0 +1,188 @@
---
label: Reference

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the name is not really self explaining.. Without reading it, I'd not know what to expect from this file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HDinger API Reference?

Comment thread lookbook/docs/20-patterns/46-drag-and-drop[api-reference].md.erb
Comment thread lookbook/docs/30-behaviors/10-sortable-lists.md.erb Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL that something like this is possible. Nice 👍

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the first time we're using this, but I think it helps make the page more manageable where we have a bunch of different options. Here's the Lookbook docs - just a matter of naming the .md.erb files accordingly.

Comment thread lookbook/docs/20-patterns/40-drag-and-drop.md.erb Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a big fan of the naming, both "behaviours" and "sortable-lists" as the name of the page... Why is that separated from the drag-and-drop page you added? Nobody will understand that they have to look below behaviors/sortable-lists if they are looking for how drag&drop can be implemented..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HDinger I've tried consolidating everything on the Patterns → Drag and drop page. Let me know what you think?

Consolidates design guidance and sortable-list implementation under
Patterns > Drag and drop to address review discoverability feedback.
Keeps scenarios in separate tabs, clarifies the API reference label,
and fixes scenario spacing and the invisible draft notice.

Refs DREAM-774.
@myabc
myabc requested a review from HDinger September 9, 2026 19:55
@myabc myabc modified the milestones: 17.9.x, 18.0.x Sep 9, 2026

@HDinger HDinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really nice. Thanks for all the effort 🙇 👏 🌟

label: Design guidance
---

> **Draft:** The design guidance on this page has not been reviewed by the design team yet.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, I would remove that before merging. I guess it is more confusing for people outside our team than it helps. Internally we can still request a review from the design team

Removes draft notice about design guidance review status.
@myabc
myabc merged commit b41711e into dev Sep 10, 2026
13 of 15 checks passed
@myabc
myabc deleted the implementation/DREAM-774-sortable-lists-docs branch September 10, 2026 13:58
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

documentation feature javascript Pull requests that update Javascript code needs review

Development

Successfully merging this pull request may close these issues.

3 participants