mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 605365 - Hide form assistant when focused element is blurred (r=mfinkle)
This commit is contained in:
parent
ad387e37bc
commit
1634ce0ddf
@ -77,6 +77,7 @@ function FormAssistant() {
|
||||
addEventListener("keypress", this, true);
|
||||
addEventListener("keyup", this, false);
|
||||
addEventListener("focus", this, true);
|
||||
addEventListener("blur", this, true);
|
||||
addEventListener("pageshow", this, false);
|
||||
addEventListener("pagehide", this, false);
|
||||
addEventListener("submit", this, false);
|
||||
@ -354,6 +355,19 @@ FormAssistant.prototype = {
|
||||
this.currentIndex = focusedIndex;
|
||||
break;
|
||||
|
||||
case "blur":
|
||||
content.setTimeout(function(self) {
|
||||
if (!self._open)
|
||||
return;
|
||||
|
||||
// If the blurring causes focus be in no other element,
|
||||
// we should close the form assistant.
|
||||
let focusedElement = gFocusManager.getFocusedElementForWindow(content, true, {});
|
||||
if (!focusedElement)
|
||||
self.close();
|
||||
}, 0, this);
|
||||
break;
|
||||
|
||||
case "text":
|
||||
if (this._isValidatable(aEvent.target))
|
||||
sendAsyncMessage("FormAssist:ValidationMessage", this._getJSON());
|
||||
|
Loading…
Reference in New Issue
Block a user