autocomplete popup sitting behind normal skuid popup

We are getting weird behaviour with autocomplete popup sitting behind skuid popup (normal dialog popup). We tried setting z-index property for autocomplete popup and it works first time and if you search again problem reappears. While inspecting element for z-index property of skuid popup and autocomplete popup we found that z-index property of skuid popup is increasing dynamically so as to make it more than z-index of autocomplete popup (i.e. if I set z-index of autocomplete popup to 105, skuid popup’s z-index will be automatically set to 106). 
The problem occurs rarely on normal reference field. However, it happens almost all the times when we use custom field renderer (which is polymorphic in nature i.e. it can search different records such as account, Contact, Service__c etc). 
Any clues?

It’s the jQueryUI dialog that is always fighting for the highest z-index.  It basically looks for the z-index of all of the dom elements that match the $(‘.ui-front’) selector and makes its z-index one higher.  In our reference renderer we just escalate this with the following code.  You could probably do something similar.

input&#46;focus(function(){<br />&#47;&#47; Fix a bug where the autocomplete could show up behind dialogs&#46;<br />input&#46;autocomplete('widget')&#46;css('z-index',parseInt(input&#46;closest('&#46;ui-front')&#46;css('z-index'),10)+1);<br />});

Thanks Ben, It worked!