Fix drag and drop on child reordering admin page

Created on 15 July 2025, 15 days ago

Problem/Motivation

The book module provides a “child order” tab for all book nodes that have more than one child node. This admin page, located at /node/{node_id}/child-ordering, displays weights for all nodes when “Show row weights” is toggled on. When toggled off, the drag and drop functionality is available for users to rearrange the nodes as desired.

  1. The drag and drop functionality doesn’t work as expected.
  • Dragging right reorders the node to the child position of the item directly above it. Assigns default weight -50 and parent item as the item directly above it.
  • Dragging left reorders the node to the child position of the book's root node. Assigns default weight -50 and keeps parent item remains the same as listed under its individual node outline.
  • Dragging up or down, reorders the node to the child position of the book's root node. Updates the weight for all items within the entire book in order from -50 – 50, thus overriding any existing weights manually entered on individual nodes. Any additional books outside of this range are assigned a default weight of 50. All parent items remain the same as listed under its individual node outline.
  • There’s no indentation styling after saving, nor any visual indication of nesting within the hierarchy.
  • There’s no way to undo nesting on the child ordering admin page via drag and drop. The weight can be updated but the parent item would be incorrect.
  • Steps to reproduce

    1. Log in as a user with "administer book outlines" and "Reorder child page of a book"
    2. Create a book with a child page and children for that child page
    3. Navigate to /node/{node_id}/child-ordering
    4. Toggle off “Show row weights”
    5. Reorder the items by dragging and dropping left, right, up, and down
    6. 6. Save outline

    Proposed resolution

    Add ability to undo/adjust nesting on child order admin page. Weights and parent items are updated to reflect any changes made via drag and drop.

    Remaining tasks

    User interface changes

    Add a visual indicator for book nesting.

    API changes

    Data model changes

    🐛 Bug report
    Status

    Active

    Version

    2.0

    Component

    User interface

    Created by

    Live updates comments and jobs are added and updated live.
    Sign in to follow issues

    Comments & Activities

    Production build 0.71.5 2024