The mysterious case of the missing Mode Selector in Sitecore 8 Experience Editor

This is such a simple bug that it’s hardly worth a blog post, but something that has been annoying me for some time that finally this week a colleague of mine pointed out the issue. I noticed a few other people suffering from this on screencasts as well.

Have you noticed that sometimes you’re in the Experience Editor and you want to switch to Preview mode after having made some edits but the switcher menu does not appear? It seemed to randomly stop working but there were no Javascript errors in the console either.

Well, it seems that it wasn’t so random after all and there was a consistency to when it would appear or not appear…

sc8-mode-selector-bug

And there you have it, the menu is appearing but the only problem is it is outside the view port!

I think the issue is due to a change in the where the selector is rendered. In earlier versions of Sitecore the menu was rendered in the scWebEditRibbon iframe along the top so scrolling would never have been an issue there. In SC8 it is inserted just before the closing body tag of the main page and the Javascript has not been updated.

The Simple Fix

The fix is pretty simple as well.

In a text editor open up: /sitecore/shell/client/Sitecore/Speak/Ribbon/Controls/LargeDropDownButton/LargeDropDownButton.js

Edit the containerStyle variable on line 103.

Change the value "position:absolute;" to "position:fixed;"

It should look like this:

var containerStyle = "position:fixed;z-index:10000;top:" + boundingClientRect.bottom + "px;left:" + (boundingClientRect.left + Sitecore.ExperienceEditor.ribbonFrame().offsetLeft) + "px;background-color:#ffffff;";

I can confirm this is an issue on Sitecore 8 update 2 to 5, possibly earlier. I will raise a ticket with Sitecore Support and update here with a ticker number.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s