diff --git a/browser/components/customizableui/src/CustomizableUI.jsm b/browser/components/customizableui/src/CustomizableUI.jsm index 557c3914bfb..995597607eb 100644 --- a/browser/components/customizableui/src/CustomizableUI.jsm +++ b/browser/components/customizableui/src/CustomizableUI.jsm @@ -1084,19 +1084,23 @@ let CustomizableUIInternal = { /* * If people put things in the panel which need more than single-click interaction, * we don't want to close it. Right now we check for text inputs and menu buttons. - * Anything else we should take care of? + * We also check for being outside of any toolbaritem/toolbarbutton, ie on a blank + * part of the menu. */ _isOnInteractiveElement: function(aEvent) { let target = aEvent.originalTarget; - let panel = aEvent.currentTarget; + let panel = this._getPanelForNode(aEvent.currentTarget); let inInput = false; let inMenu = false; - while (!inInput && !inMenu && target != aEvent.currentTarget) { - inInput = target.localName == "input"; + let inItem = false; + while (!inInput && !inMenu && !inItem && target != panel) { + let tagName = target.localName; + inInput = tagName == "input"; inMenu = target.type == "menu"; + inItem = tagName == "toolbaritem" || tagName == "toolbarbutton"; target = target.parentNode; } - return inMenu || inInput; + return inMenu || inInput || !inItem; }, hidePanelForNode: function(aNode) {