Bug 720058 - Only allow showing one select ui at a time. r=bnicholson

This commit is contained in:
Wes Johnston 2012-01-25 01:31:33 +01:00
parent f379bd7585
commit 1e562aeed7

View File

@ -2671,6 +2671,7 @@ var FormAssistant = {
// Used to keep track of the element that corresponds to the current
// autocomplete suggestions
_currentInputElement: null,
_uiBusy: false,
init: function() {
Services.obs.addObserver(this, "FormAssist:AutoComplete", false);
@ -2775,13 +2776,20 @@ var FormAssistant = {
},
handleClick: function(aTarget) {
// if we're busy looking at a select we want to eat any clicks that
// come to us, but not to process them
if (this._uiBusy)
return true;
let target = aTarget;
while (target) {
if (this._isSelectElement(target) && !target.disabled) {
this._uiBusy = true;
target.focus();
let list = this.getListForElement(target);
this.show(list, target);
target = null;
this._uiBusy = false;
return true;
}
if (target)
@ -2834,6 +2842,9 @@ var FormAssistant = {
disabled: aNode.disabled,
id: aIndex
}
if (result.listitems[aIndex].inGroup)
result.listitems[aIndex].disabled = result.listitems[aIndex].disabled || aNode.parentNode.disabled;
result.selected[aIndex] = aNode.selected;
});
return result;