Bug 1312244 - Autocomplete popup does not close when anchor clicked a second time. r?Enn
The popuphiding / popuphidden events are fired synchronously when the popup manager
decides we're doing a "rollup" (closing the popups due to "outside" events). In the case
of this bug, the "outside" event is a click on the input element in content.
Here's the kicker though: we handle that popuphidden event and queue a message to content
_before_ the mouse event that caused the roll-up is dispatched to content. This means that
browser-content.js hears that the popup closed due to popuphidden first, sets its internal
state of popupClosed to true, and then the MouseDown on the input field is processed. The
nsFormFillController then queries browser-content's AutoCompletePopup, sees its closed,
and tells the parent to open it again.
This patch adds the norolluponanchor attribute to the panel, which causes us to ignore the
rollup event if it happens to be targeted within the anchor rect. This means that we need
to trust content to tell us to close the autocomplete popup if the input is clicked when
the popup is open (and this is what
bug 1183037, which this bug depends on, does).
MozReview-Commit-ID: 4A9qVfTYIUz
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -136,17 +136,22 @@
<menupopup id="backForwardMenu"
onpopupshowing="return FillHistoryMenu(event.target);"
oncommand="gotoHistoryIndex(event); event.stopPropagation();"
onclick="checkForMiddleClick(this, event);"/>
<tooltip id="aHTMLTooltip" page="true"/>
<tooltip id="remoteBrowserTooltip"/>
<!-- for search and content formfill/pw manager -->
- <panel type="autocomplete-richlistbox" id="PopupAutoComplete" noautofocus="true" hidden="true"/>
+
+ <panel type="autocomplete-richlistbox"
+ id="PopupAutoComplete"
+ noautofocus="true"
+ hidden="true"
+ norolluponanchor="true" />
<!-- for search with one-off buttons -->
<panel type="autocomplete" id="PopupSearchAutoComplete" noautofocus="true" hidden="true"/>
<!-- for url bar autocomplete -->
<panel type="autocomplete-richlistbox"
id="PopupAutoCompleteRichResult"
noautofocus="true"