Friday, June 11, 2010

Issues with moving search into top ribbon bar

I was recently on a project where there was a requirement to have many items in the main navigation. There was not an option to consolidate these into smaller groups. The idea was to move the search box up into the top ribbon bar.

image

This would allow for more horizontal space for the navigation items. However in my attempt to move the search I found a little gotcha. I selected the search control in SharePoint Designer and moved it right above the welcome navigation control code.

image

Wrapped the control in a div tag and temporarily added an inline style of float left.

<div style="float: left;">
   <asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server">
      <SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox" Version="4"/>
   </asp:ContentPlaceHolder>
</div>

image

I saved the master page and then checked out what it looked like. The search was moved up correctly but it was not until I used IE8 dev toolbar to check for compatibility in IE7.

image

As you can see below in IE7 the search, and welcome link/drop down is no where to be seen and the ribbon tabs got all squished.

image

After doing some testing in IE7 mode an inline style gets applied to the ms-cui-TabRowRight with “Display: none”

image

I am not 100% why this is, but if I try to put the search anywhere else in the ribbon it just does not show… So I guess this is more of a warning to the designers out there. If you are thinking about putting the search in the top ribbon bar in your design comps know that there might be some issues with browser compatibility.

So what I ended up doing is moving the search to the left of the Social Notification tags. Wrapped it in a <td> tag and called it a day. The client was happy with the results since they were still able to have their navigation items and the search moved to a different location.

image

image

Please comment on this post if you have seen this issue before or have found a fix. Thanks!

15 comments:

marcel said...

I have the same problem when i customize the ribbon. I've been looking around to see what the problem is, i see when you use the default ribbon, this div class 'ms-cui-tts' is used, but when you customize it, it uses this div class 'ms-cui-tts-scale-2'. In 'ms-cui-tts-scale-2' css you'll see that the width is 0.

Do you see the same?

Anonymous said...

Thanks for this post - I needed to move the Search box and had trouble doing it in the Design mode. I have no code knowledge but copied your code and managed to move the search to sit beside the social buttons.

Chze Yin said...

I wrap Welcome component and the search into one table and it works find in my design, both in IE7 and IE8... :)

Elio said...

Hey, I did this 2 months ago for a client. you need to specify a with to the searchbox. I have made a post on my blog so that you can see how I solved it.

http://estruyf.be/blog/moving-the-searchbox-into-the-top-ribbon/

Erik Swenson said...

Thanks Elio,

Next time I need to move the search I will try out your approach.

Elio said...

No problem!

Jessica said...

FYI: Elio's solution works brilliantly. Just deployed it to a major client's intranet. Stood up to QA testing. No issues so far....

Paul said...

Elio, thanks a lot for the solution. I had been working on this, and I was able to get the search bar and help button in the correct locations, but the search bar would not allow any editing.

I had edited the master page in Visual Studio, and the only way I could get it to show properly was to actually add the controls to the RibbonContainer-TabRowLeft portion, and use absolute positioning, etc. to show it on the right.

Now it's working great, so thanks!

Paul

balan said...

Awesome. Simple but really a great stuff.

Locksmiths said...

Thank you so much for this. I also had a problem with too many links in the navigation bar and had to move the search feature. Now it's the matter of styling the search icon and background for it.

king said...

How to apply roundede corners to search box in sharepoint 2010 search box?What has to changed in .css?

lj said...

This one customisation of the styling both changed the style to ms-cui-tts-scale-2 as well as resulted in the hiding of the right tab area as well....
#s4-ribbonrow,
#s4-ribbonrow *
{
border-width:0px;
}

lj said...

addition to last post... use this instead to remove the border of the tool bar
.ms-cui-topBar2{
border-width:0px;
}

Michal Mistina said...

I tried to prepare the new div area to the left side of the the WelcomeMenu button where I would insert SiteActions button. Logically I would think I would place WelcomeMenu to the right (float:right) and new div to the left (float:left). Shifting WelcomeMenu can be done by adjusting s4-trc-container-menu class where the default declaration is float:left. If I changed it to the float:right I got the same issue as is described in this article. No fix.

vincentadell said...

Moving items in ribbon bar