Sitecore Template Manager - fix for the Tab key

Posted 12 June 2017 by Marek Musielak

sitecore template manager - fix for the tab key

Editing Sitecore templates - every Sitecore developer does it. It doesn't matter if you're using Template Manager application or if you create and edit Sitecore templates in Content Editor, there is one thing which is broken in both. It's the tab key functionality.

Let's assume you want to add three Single-Line Text fields to your template. You start with typing first field name. Now you have 2 options: either you move your hand away from your keyboard to grab a mouse and move mouse cursor to another field name input (or one of the Unversioned or Shared checkboxes), or you press the tab key on your keyboard. I don't use mouse if I don't have to. Some say I have a keyboard shortcut for everything. That's why I would never go for the first option normally. But I have to. Pressing tab key once focuses Type dropdown, pressing it again focuses Source, then Unversioned checkbox and then nothing. Sitecore javascript code does breaks the functionality of the tab key. Focus stays on Unversioned checkbox forever.

sitecore template manager broken on unversioned checkbox

It took me some time but finally I raised a Sitecore Support bug for it. The answer was:

As a workaround for the issue, please open the \sitecore\shell\Controls\Sitecore.js file and replace the following:

if (evt.keyCode == 8 && (srcElement.className && srcElement.className.toLowerCase().indexOf("checkbox") >= 0) ||
  (srcElement.type && srcElement.type.toLowerCase() == "checkbox")) {
  scForm.browser.clearEvent(evt, false, false, 8);
}

with

if (evt.keyCode == 8 && ((srcElement.className && srcElement.className.toLowerCase().indexOf("checkbox") >= 0) ||
  (srcElement.type && srcElement.type.toLowerCase() == "checkbox"))) {
  scForm.browser.clearEvent(evt, false, false, 8);
}

Note: do not forget to clear your browser's cache.

The only difference in those code snippets is extra bracket around the part of the condition. And it works. I don't like the fact that I need to change Sitecore.js file and that after I upgrade to a newer Sitecore version I will have to change this file again. But as long as it does the trick, I'll do this every time I start a new Sitecore project.

Thank you for reading. I hope you enjoyed. Visit my Sitecore blog for more Sitecore related articles.

Comments? Find me on or Sitecore Chat