mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 09:45:41 +00:00
Bug 1152517 - Recipient autocomplete wrongly considers last mouse-hovered contact from results dropdown "selected" and then uses that unintended, random recipient upon blur (via Tab, Enter, or when moving to subject or body). r=mak
--HG-- extra : rebase_source : 8b11a0a5d6b9a41fbe3102ff17f83f452d1601b9
This commit is contained in:
parent
ee6b010108
commit
422a1bbf1d
@ -608,8 +608,27 @@
|
||||
|
||||
<handler event="blur" phase="capturing"><![CDATA[
|
||||
if (!this._dontBlur) {
|
||||
if (this.forceComplete && this.mController.matchCount >= 1)
|
||||
if (this.forceComplete && this.mController.matchCount >= 1) {
|
||||
// mousemove sets selected index. Don't blindly use that selected
|
||||
// index in this blur handler since if the popup is open you can
|
||||
// easily "select" another match just by moving the mouse over it.
|
||||
let filledVal = this.value.replace(/.+ >> /, "").toLowerCase();
|
||||
let selectedVal = null;
|
||||
if (this.popup.selectedIndex >= 0) {
|
||||
selectedVal = this.mController.getFinalCompleteValueAt(
|
||||
this.popup.selectedIndex);
|
||||
}
|
||||
if (selectedVal && filledVal != selectedVal.toLowerCase()) {
|
||||
for (let i = 0; i < this.mController.matchCount; i++) {
|
||||
let matchVal = this.mController.getFinalCompleteValueAt(i);
|
||||
if (matchVal.toLowerCase() == filledVal) {
|
||||
this.popup.selectedIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.mController.handleEnter(false);
|
||||
}
|
||||
this.detachController();
|
||||
}
|
||||
]]></handler>
|
||||
|
Loading…
Reference in New Issue
Block a user