Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

If DropDownMenuItem is first item below SectionMenuItem, menu does not work

Found in

EPiServer.CMS.UI 11.23.0

Fixed in

EPiServer.CMS.UI 11.23.3

(Or a related package)

Created

Dec 02, 2019

Updated

Dec 20, 2019

Area

CMS UI

State

Closed, Fixed and tested


Description

If a DropDownMenuItem is the first menu item below a SectionMenuItem, it does not select when viewing from other parts of the UI.

Steps to reproduce

  1. Use this code:

using System.Collections.Generic;
using EPiServer.Shell.Navigation;
 
namespace MenuBug
{
    [MenuProvider]
    public class MenuBugExample : IMenuProvider
    {
        public const string MenuWaffleMenu = "/global/newwafflemenuitem";
        public const string MenuDropDownTopLevelMenu = "/global/newwafflemenuitem/example";
 
        public IEnumerable<MenuItem> GetMenuItems()
        {
            // use for sub menu item off CMS
            return new MenuItem[]
            {
                new SectionMenuItem("New waffle menu item", MenuWaffleMenu) {IsAvailable = (_) => true},
                new DropDownMenuItem("Example dropdown", MenuDropDownTopLevelMenu) {IsAvailable = (_) => true, SortIndex = 100},
                new UrlMenuItem("Clickable menu item", MenuDropDownTopLevelMenu + "/menu item", "/episerver")
            };
        }
    }
}

2. Browse to the CMS.
3. Try and select the "New waffle menu item" menu item.

Expected
Select the first menu within the hierarchy that has a URL.

Actual
No menu is selected.