The SharePoint Designer

Brand. Design. Amaze.

Sep 28

When .selected goes rogue – help request

No Gravatar


I offered to help a fellow SharePointier out, and had a look at her top link bar – and more importantly, why the class .selected doesn’t work. This is more common thank you think – and is an issue I struggle with, with every site I make.  And Tasha’s problem has me floored. So here it is.

ISSUE:
Go to Tash’s site : http://www.hrssug.org/TashasSpot
You will see Home is selected. Click SharePoint, it will refresh and show you her SharePoint page, and the top nav link is selected.
Now click Food & Drink. It moves you to that page but the top nav link is not selected, but for some reason SharePoint IS selected. If you click Home and then back to Food & Drinks, SharePoint will be selected not Food & Drinks.

WHAT I HAVE DONE SO FAR:
I used Web Dev Tools to check the selected links – and then when I moved to Food and drink – I checked that class: no selected class.
I changed the order of the menu – so I moved Food & Drink to order 2, and presto! Food & Drink now shows the selected class when selected.

SO THE ISSUE NOW:
So we know that the first two top nav links show selected and the rest done. Why? and How do we fix it?

 

Tags:

2 Comments

  1. Josh McCartyNo Gravatar

    September 28, 2011

    Reply

    I’m pretty sure it’s because the actual page that those links go to is the same – “Category.aspx.” SharePoint doesn’t distinguish between different query strings in the URL, it just applies the “selected” class to the first menu item that matches the current page.
    I did some testing after reading this and came across some interesting behavior when linking to list views/items instead of pages (which is what the blog Category views are).
    For instance, if you create a link to a list view, no matter what view you’re on, that link will always by highlighted while you’re viewing that list. You can test this by viewing the AllCategories.aspx page on the site you linked above – the first menu item (after Home) is still highlighted, because you’re viewing the “Categories” list.

    • TashaNo Gravatar

      September 28, 2011

      Reply

      Thanks to Miss Lou for taking the time to post about this and to Josh for his insight! This actually makes a lot of sense, and some of the things I read online about this problem kinda hint towards this but don’t make it all the way there. Now, to see if we can find a solution…
      Tasha

Leave a comment

The SharePoint Designer is using WP-Gravatar