Skip to content

Section Sidebar Menu Expansion #19810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 120 commits into
base: main
Choose a base branch
from
Open

Conversation

madsrasmussen
Copy link
Contributor

@madsrasmussen madsrasmussen commented Jul 29, 2025

This PR adds functionality to remember the Section Sidebar Menu state across sections. It also introduces different contexts to interact with the menu from the backoffice. The state remains synchronized across all contexts. No matter where the state is updated, it will be reflected in the related contexts.

The PR includes a sample playground that demonstrates the current state for the section and across sections via dashboards. It is possible to close any open menu item from the dashboard. The example also registers a "Collapse Menu Item"-entity action to show interaction with a local menu item state.

Demo video of the example:
https://github.com/user-attachments/assets/d1267a87-f76e-42aa-a8d5-aa76e6a53741

Global State
UMB_SECTION_SIDEBAR_MENU_GLOBAL_CONTEXT
Wraps the entire application and tracks states for all sections.

Section State
UMB_SECTION_SIDEBAR_MENU_SECTION_CONTEXT
Wraps a section and tracks the state for all menu items inside a section

Menu Item State
UMB_MENU_ITEM_CONTEXT
Wraps the menu item and tracks the state for this menu item.

Partly fix of #17074
Partly fix of #17076

Additional PRs coming to support deep link into paginated tree structure menus and remembering the last visited item when navigating between sections.

Introduces an 'events' property to UmbExtensionSlotElement, allowing dynamic assignment and removal of event listeners on extension components. Event listeners are added when extensions are permitted and removed on disconnect, improving extensibility and event handling for extension slots.
Introduces handlers for entity expansion and collapse events in the section sidebar menu. This change enables the menu to respond to expansion state changes by updating the context accordingly.
Introduces a local expansion state to both section sidebar and tree menu item components to prevent unnecessary updates and rerenders. This improves performance by ensuring state updates only occur when needed.
@madsrasmussen madsrasmussen marked this pull request as ready for review August 13, 2025 12:19
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a comprehensive Section Sidebar Menu expansion state management system across sections in the Umbraco backoffice. The implementation adds the ability to remember menu expansion states across different sections and provides synchronized state management through global, section, and menu item contexts.

  • Implements three-tiered context architecture (Global, Section, Menu Item) for expansion state management
  • Adds automatic menu expansion for workspace breadcrumb navigation
  • Updates test automation helpers to use consistently named methods for tree expansion

Reviewed Changes

Copilot reviewed 137 out of 141 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/Umbraco.Tests.AcceptanceTest/package.json Updates test helper package version to support new expansion method names
tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig//.spec.ts Updates test methods from clickCaretButton* to openCaretButton* for consistency
src/Umbraco.Web.UI.Client/src/packages/core/utils/expansion/ Adds new entity expansion utilities and manager for state management
src/Umbraco.Web.UI.Client/src/packages/core/menu/section-sidebar-menu/ Implements section-specific menu expansion contexts and managers
src/Umbraco.Web.UI.Client/src/packages/core/menu/components/ Adds menu and menu item expansion management components
src/Umbraco.Web.UI.Client/src/packages/*/menu/manifests.ts Updates menu item manifests to include menu structure workspace context configuration
src/Umbraco.Web.UI.Client/examples/section-sidebar-menu-expansion/ Adds example playground dashboard and entity action demonstrating the new functionality
Files not reviewed (1)
  • tests/Umbraco.Tests.AcceptanceTest/package-lock.json: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

name: 'Document Type Menu Structure Workspace Context',
alias: 'Umb.Context.DocumentType.Menu.Structure',
api: () => import('./document-type-menu-structure.context.js'),
meta: {
menuItemAlias: 'Umb.MenuItem.DocumentTypes',
Copy link
Preview

Copilot AI Aug 13, 2025

Choose a reason for hiding this comment

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

This hardcoded alias should use a constant like other manifests. Consider importing UMB_DOCUMENT_TYPE_MENU_ITEM_ALIAS from the constants file to maintain consistency.

Suggested change
menuItemAlias: 'Umb.MenuItem.DocumentTypes',
menuItemAlias: UMB_DOCUMENT_TYPE_MENU_ITEM_ALIAS,

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants