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 // Used to keep track of the element that corresponds to the current
// autocomplete suggestions // autocomplete suggestions
_currentInputElement: null, _currentInputElement: null,
_uiBusy: false,
init: function() { init: function() {
Services.obs.addObserver(this, "FormAssist:AutoComplete", false); Services.obs.addObserver(this, "FormAssist:AutoComplete", false);
@ -2775,13 +2776,20 @@ var FormAssistant = {
}, },
handleClick: function(aTarget) { 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; let target = aTarget;
while (target) { while (target) {
if (this._isSelectElement(target) && !target.disabled) { if (this._isSelectElement(target) && !target.disabled) {
this._uiBusy = true;
target.focus(); target.focus();
let list = this.getListForElement(target); let list = this.getListForElement(target);
this.show(list, target); this.show(list, target);
target = null; target = null;
this._uiBusy = false;
return true; return true;
} }
if (target) if (target)
@ -2834,6 +2842,9 @@ var FormAssistant = {
disabled: aNode.disabled, disabled: aNode.disabled,
id: aIndex id: aIndex
} }
if (result.listitems[aIndex].inGroup)
result.listitems[aIndex].disabled = result.listitems[aIndex].disabled || aNode.parentNode.disabled;
result.selected[aIndex] = aNode.selected; result.selected[aIndex] = aNode.selected;
}); });
return result; return result;