Skip to content

Fix "allow children" property on Custom Item Types#108

Merged
AaronSadlerUK merged 2 commits into
AaronSadlerUK:developfrom
JBoye:fix-allow-children
Feb 13, 2026
Merged

Fix "allow children" property on Custom Item Types#108
AaronSadlerUK merged 2 commits into
AaronSadlerUK:developfrom
JBoye:fix-allow-children

Conversation

@JBoye

@JBoye JBoye commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

AllowChildren is now respected when creating custom items.

Default behavior (allowChildren: true) is preserved for built-in items.

Skærmbillede 2026-02-12 kl  13 18 31

Copilot AI review requested due to automatic review settings February 12, 2026 12:21

Copilot AI left a comment

Copy link
Copy Markdown

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 implements support for the allowChildren property on custom item types in the UmbNav navigation editor. The feature allows developers to create custom item types (like dividers or buttons) that cannot have child items, while preserving the default behavior of allowing children for built-in item types.

Changes:

  • Added allowChildren property to the ModelEntryType type definition
  • Added allowChildren property and logic to the umbnav-item component to conditionally hide the expand/collapse arrow
  • Updated umbnav-group component to respect the allowChildren property when creating custom items and rendering the UI

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
Umbraco.Community.UmbNav/src/tokens/umbnav.token.ts Adds the optional allowChildren property to the ModelEntryType type definition
Umbraco.Community.UmbNav/src/components/umbnav-item/umbnav-item.ts Adds allowChildren property with default value true and hides expand arrow when set to false
Umbraco.Community.UmbNav/src/components/umbnav-group/umbnav-group.ts Sets allowChildren from registration, prevents expansion and applies collapsed class for items that don't allow children

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

noreferrer: defaults.noreferrer ?? null,
image: defaults.image ?? [],
children: [],
allowChildren: registration.allowChildren

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

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

The allowChildren property is set directly from registration.allowChildren without a default value. While the current logic correctly treats undefined as allowing children (via the !== false checks), it would be more explicit and maintainable to set a default value here. Consider using allowChildren: registration.allowChildren ?? true to make the default behavior more obvious and consistent with the component's default value.

Suggested change
allowChildren: registration.allowChildren
allowChildren: registration.allowChildren ?? true

Copilot uses AI. Check for mistakes.
Comment on lines 379 to 385
noreferrer: defaults.noreferrer ?? null,
image: defaults.image ?? [],
children: [],
allowChildren: registration.allowChildren
};
this.#addItem(newItem);
}

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

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

Consider adding test coverage to verify that items created with allowChildren: false do not display the expand/collapse arrow and do not allow children to be added. The current tests verify that custom items can be created with allowChildren: false, but they don't verify the functional behavior of this property.

Copilot uses AI. Check for mistakes.
@AaronSadlerUK AaronSadlerUK merged commit 276aa98 into AaronSadlerUK:develop Feb 13, 2026
8 of 10 checks passed
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.

3 participants