Bug: Sitecore Multilist and Treelist With Search Field Search Not Working Intermittently
The following bug was confirmed in Sitecore 7.2 revision 140256, yet it is possible that previous versions of Sitecore 7 were affected as well. This article provides a patch for the search functionality of the new TreeList and Multilist with Search fields in Sitecore Content or Page Editors.
Sitecore TreeList and Multilist with Search Fields Search Issue in Firefox
Lately I have run into more bugs than any other time in Sitecore (is it the star alignment?). I have been finishing up the article describing how to highlight search terms using Solr with Sitecore, when this bug surfaced. Once again I decided to delay a “how to” post and write about the new bug instead.
With the release of Sitecore 7 the CMS client editing interface started to heavily rely on search. Item Buckets module integration called for a type of field that would be able to work with the new content structure – the TreeList and Multilist with Search fields were born.
At first the fields were a bit different, however, as the new updates and patches started being rolled out, the two became twins; therefore, in Sitecore 7.2 the TreeList with Search has been deprecated (Ctrl+F for “The “Treelist with Search” field type has been deprecated in favor “)
Although the Treelist with Search has been sent into the dark section of the Deprecated Fields in the field type list, it is still within the scope of this issue. At a risk of being redundant, I want to point out that since both fields are now identical – the issues they experience would also be the same (and who said you can’t get two rabbits with one stone?)
We were heading fast towards the end of the development cycle on one of our projects, when we spotted the issue. It took a while to recognize it, as most of the developers used Google Chrome browser for development and only launched other browsers for cross-browser checks of the website’s front end. Once we started pushing heavier into the Quality Assurance testing zone, we found that the Multilist and Treelist with Search fields were working intermittently in the Firefox browser. Later we experienced a similar issue in Chrome, however, could not reproduce it again later. Having flagged that as a lower priority we focused on other items, until we heard about this annoyance from our client. It turns out that they were big fans of the Firefox browser. Since now we had a client not being able to use the problematic fields, the priority of the issue sky-rocketed.
To reproduce the bug – clear the Firefox cache and login to Sitecore Content Editor, then navigate to any item which has either a Treelist or a Multilist with Search field and click inside the “Type here to search” textbox. The first thing you will notice is that the placeholder text did not get removed when you licked inside the textbox. Next, try highlighting the placeholder text and manually removing it, then typing in the search query and hitting Enter – nothing happens, right?
Now try clicking on the same content item to reload it and repeat the steps above over again. All of a sudden the search field would start working – the placeholder text would get removed and the search would start working after entering a query and hitting Enter.
Fix for Sitecore Multilist and TreeList with Search Bug
After reaching out to Sitecore enthusiasts online, it was clear that the issue was not a popular one, which was surprising, as Firefox happens to be the most popular browser in the world.
After not finding any related information online I reached out to Sitecore Support. They were able to quickly reproduce the issue and fairly quickly came back with the a solution.
This worked like a charm and were happy to respond to our client with a solution. Sitecore Support saved the day once again!
Hopefully, this post will save many developers hours or days of troubleshooting, and please share this article, as many more developers will thank you. Also remember to comment if this worked for you, and give back by blogging, tweeting, and posting on Sitecore forums about any bugs and fixes you find yourself!