diff --git a/src/components/sidebar/helpers/get-filtered-nav-items.ts b/src/components/sidebar/helpers/get-filtered-nav-items.ts index ee614ffe4d..8eac67923b 100644 --- a/src/components/sidebar/helpers/get-filtered-nav-items.ts +++ b/src/components/sidebar/helpers/get-filtered-nav-items.ts @@ -40,6 +40,21 @@ export const getFilteredNavItems = ( ?.toLowerCase() .includes(filterValue.toLowerCase()) + // Check and filter alias + const hasAlias = item.hasOwnProperty('alias') + if (hasAlias) { + const doesAliasMatchFilter = ( + item as SubmenuNavItemWithMetaData | LinkNavItemWithMetaData + ).alias + ?.toLowerCase() + .includes(filterValue.toLowerCase()) + + // Add to filtered items if filter value is in alias + if (doesAliasMatchFilter) { + filteredItems.push({ ...item, matchesFilter: true }) + } + } + /** * If an item's title matches the filter, we want to include it and its * children in the filter results. `matchesFilter` is added to all items diff --git a/src/components/sidebar/types.ts b/src/components/sidebar/types.ts index f91a11563b..aa6cc17741 100644 --- a/src/components/sidebar/types.ts +++ b/src/components/sidebar/types.ts @@ -28,6 +28,7 @@ interface HeadingNavItem { interface BaseNavItem { badge?: SidebarNavMenuItemBadgeProps hidden?: boolean + alias?: string title: string }