Possible Bug - Reorganising Categories

AI-generated summary

RobMeade reported a possible bug in the category reordering feature, noting that typing a position number causes immediate reordering without page scrolling, and the cursor loses focus when entering multiple digits. They also mentioned that auto-shuffling seems limited to positions up to 99 and that the green tick disappears when using up/down arrows. vinothkannans addressed the issues, confirming that categories now reorder only when leaving the text box and that the page scrolls to the correct position after tabbing out. They also implemented indentation for subcategories and resolved the issue of subcategories updating only after saving. RobMeade expressed gratitude and asked about deployment timing, to which vinothkannans responded they would ensure an update soon.

I was reordering some of our categories earlier and I noticed a minor issue.

If you type the position into the text box, as soon as you enter the first character it gets moved, this isn’t too bad but the focus on the page doesn’t scroll with it. At this point the cursor is still focused in the text box. You enter the second number and again the category moves, but you arent scrolled to find it. When you try to enter the third number (we have over 100 categories) you discover the cursor is no longer focused within the text box.

The possible bug is that it seems only auto-shuffling is enable for positions up to 99.

Another possible issue is that if you enter a position, but then use the up or down arrow icons, the green tick disappears, presumably committing the change that the green tick would have?

As wish-list enhancement ideas, it would be nice if;

  • the page scrolled to the position of the auto-shuffled category
  • when moving a category, all sub-categories were also moved at the same time. Currently they appear to get updated only when the “Save” button is pressed, e.g if you immediately go back into the Reorder Categories option they have moved
  • drag control for categories instead of (as well as?) the up/down arrows
  • smaller modal and scroll within that rather than with entire height of page, current model is quite user-navigation intensive when there are lots of categories

I hope the above is of use :slight_smile:

I did few improvements in below commit. Indented alignment is used to differentiate subcategories from main categories.

https://github.com/discourse/discourse/commit/d5df746cc318c9422f5704edd7fd652b0eab9fd3

:white_check_mark:

:white_check_mark: Now categories will reorder only when you leave the textbox. If you press Tab key to leave the textbox then the page will get scrolled to the correct position.

Oh wow, I wasn’t expecting anyone to do anything so quickly! Thank you Vinoth. :slight_smile:

Any idea when this will make its way to our hosted solution?

I will make sure to update it to your site sooner.

Thank you, that’s really kind, I appreciate your help and support :slight_smile: