Skip to content

Conversation

@ArjunCodess
Copy link

@ArjunCodess ArjunCodess commented Oct 1, 2025

fixes #4350

Problem

When dragging toolbar items from a subgroup to the main toolbar (or between different groups), the indentation was not updating correctly. Items would maintain their previous indentation level instead of adjusting to match their new position.

Root Cause

The moveItem function in customize-toolbar.tsx had flawed depth calculation logic:

  • It would first set the depth to match the target item's depth
  • Then only if moving to a group, it would add 1 to the depth
  • This caused incorrect indentation when moving between different levels

Solution

Improved the depth calculation logic to properly handle all movement scenarios:

// Calculate the correct depth based on where the item is being moved
if (movingToGroup) {
  // If moving to a group/subgroup, set depth to group's depth + 1
  fromItem.depth = toItem.depth + 1;
} else {
  // If moving to another item, set depth to match the target item's depth
  fromItem.depth = toItem.depth;
}

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Signed-off-by: Arjun Vijay Prakash <arjunv.prakash12345@gmail.com>
Signed-off-by: Arjun Vijay Prakash <arjunv.prakash12345@gmail.com>
@ArjunCodess
Copy link
Author

@ammarahm-ed hey! :)

if there is anything left to implement / anything to be edited, please let me know!

Copy link
Contributor

@thecodrr thecodrr left a comment

Choose a reason for hiding this comment

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

Thanks!

Signed-off-by: Arjun Vijay Prakash <arjunv.prakash12345@gmail.com>
Signed-off-by: Arjun Vijay Prakash <arjunv.prakash12345@gmail.com>
@ArjunCodess ArjunCodess requested a review from thecodrr October 2, 2025 07:36
@ArjunCodess ArjunCodess changed the title web: correct toolbar item indentation when moving between groups web: correct toolbar item indentation when moving between groups + add tests for customize-toolbar.tsx Oct 2, 2025
@ArjunCodess
Copy link
Author

@thecodrr done!

@ArjunCodess
Copy link
Author

@thecodrr just a follow-up.

1 similar comment
@ArjunCodess
Copy link
Author

@thecodrr just a follow-up.

…-toolbar.tsx

Signed-off-by: Arjun Vijay Prakash <arjunv.prakash12345@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Moving editor tools around doesn't update indentation

2 participants