Use a higher delta for reordering a list of more than 21 items

Created on 21 April 2023, about 1 year ago
Updated 22 January 2024, 5 months ago

Problem/Motivation

When at a certain level of a book there are more than 21 items reordering them can be harder because the delta of the weight is set to "10". This means that there are 21 posssible values for the weight field: from -10 to 10.

Steps to reproduce

  1. Add a book.
  2. Add 22 child pages. (I called them "A" till "V").
  3. On the page "Outline", place the 22nd page (V) before the 21nd one (U) by dragging it.
  4. Click "Update book outline".

The page "V" remains the 22nd in the list. That's because both page "U" and "V" now have a weight of 10.

Proposed resolution

The core book module uses a default weight of 15 and increases that as soon as there are more than 30 pages. In that case the delta is about the half of the number of pages.

I personally like that there's a bit more room in weight choice so when you edit the row weight manually (after clicking "Show row weights") there are less weight values that need to be updated. Because when you are busy adding and deleting pages a gap between the weights of pages can occur.

I propose to default to a delta of 20. When there are more than 30 child pages, use a delta of about 2/3 of the number of pages.

Remaining tasks

  • Review
  • Commit

User interface changes

The weight field's range of values will increase depending on the number of pages.

API changes

None.

Data model changes

None.

Code will follow.

✨ Feature request
Status

Fixed

Version

1.0

Component

User interface

Created by

πŸ‡³πŸ‡±Netherlands MegaChriz

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

Comments & Activities

Production build 0.69.0 2024