Skip to content

Nested category with blocks in parent should collapse when dragging block #9392

@TannerGabriel

Description

@TannerGabriel

Check for duplicates

  • I have searched for similar issues before opening a new one.

Problem

No response

Request

Currently, when a parent toolbox category contains blocks alongside nested categories, reopening the parent category after dragging a block requires a double click, since the category is not collapsed automatically. This creates unnecessary friction.

Expected behavior:

  • If the parent category contains blocks: collapse the parent after a block is dragged, so reopening the nested category only requires a single click.
  • If the parent category contains no blocks: keep the current behavior.

More context in this group discussion.

Reproduction Steps

  1. Create sample app: npx @blockly/create-package app hello-world
  2. Add a nested toolbox category with blocks in the parent category
  3. Open the nested category
  4. Drag a block onto the workspace
  5. Try reopening the parent category (Requires double click)

Example toolbox config:

    {
      kind: 'category',
      name: 'Nested',
      categorystyle: 'text_category',
      contents: [
        {
          kind: 'block',
          type: 'text',
        },
        {
          kind: 'block',
          type: 'text_join',
        },
        {
          kind: 'category',
          name: 'Nested Level 2',
          categorystyle: 'text_category',
          contents: [
            {
              kind: 'block',
              type: 'text_join',
            },
            {
              kind: 'block',
              type: 'text_indexOf',
            },
            {
              kind: 'block',
              type: 'text_getSubstring',
            },
            {
              kind: 'block',
              type: 'text_changeCase',
            }
          ]
        }
      ]
    }
  ],
};
screenrecording-2025-09-29_11-39-15.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bugDescribes why the code or behaviour is wrong

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions