This project is read-only.

Changes to core MenuItem shape

Topics: Core
Mar 5, 2013 at 4:07 AM
@sebastianros I have a concern about a change you made to the core MenuItem.cshtml view as part of the changes for the new ShapeMenuItem.

I noticed that you now set the "current" css class based on the value of Model.Selected (previously this was set by comparing the requested url with the menuitem model url directly in the view).

This works fine for ContentItem menu items (and looks much cleaner), however when I build up a multi-depth hierarchy of CustomLink menu items, the "current" class is not being added to those items when they are selected (neither the selected items or any parent items that happen to also be CustomLink menu items).

Model.Selected (MenuItem.Selected) is set by the call to SetSelectedPath() in Framework\UI\Navigation\NavigationHelper.cs and inside the SetSelectedPath() routine it is comparing the RouteValues of each MenuItem to the current route information.

The problem is that (for whatever reason) MenuItem.RouteValues is null for CustomLink menu items. I'm thinking the fix will either involve investigating why CustomLink menu items do not have their RouteValues property set, or alternatively the SetSelectePath() method in NavigationHelpers.cs could possibly make a call to try to resolve the route information for a menu item (from the Href or Url property) in the case where its RouteValues property is null?
Mar 5, 2013 at 4:13 AM
Please file a bug.
Mar 5, 2013 at 4:31 AM
Raised the following issue...