Index: typo3/js/livesearch.js =================================================================== --- typo3/js/livesearch.js (revision 10142) +++ typo3/js/livesearch.js (working copy) @@ -46,7 +46,6 @@ resizable: false, title: null, width: 205, - hasIframeListeners: false, triggerClass : 'x-form-clear-trigger', triggerConfig: ' ', @@ -243,10 +242,6 @@ onFocus : function() { TYPO3.BackendLiveSearch.superclass.onFocus.apply(this, arguments); - if (!this.hasIframeListeners) { - this.addIframeListeners(); - } - // If search is blank, show the help on focus. Otherwise, show last results if (this.getValue() == '') { this.initHelp(); @@ -270,30 +265,14 @@ TYPO3.BackendLiveSearch.superclass.reset.apply(this, arguments); }, - addIframeListeners : function () { - // Add an event handler to each iframe, closing the search window when there's a click inside the iframe - // @todo Is there a cleaner way to handle this? - var iframes = Ext.query('iframe'); - Ext.each(iframes, function(item, index, allItems) { - item.contentWindow.document.body.onclick = function() { - if (parent.TYPO3LiveSearch && parent.TYPO3LiveSearch.hasFocus) { - if (parent.TYPO3LiveSearch.isExpanded()) { - parent.TYPO3LiveSearch.collapse(); - } - - if (parent.TYPO3LiveSearch.getRawValue() == '') { - parent.TYPO3LiveSearch.originalValue = parent.TYPO3LiveSearch.emptyText; - parent.TYPO3LiveSearch.reset(this); - } - - if (parent.TYPO3LiveSearch.helpList.isVisible()) { - parent.TYPO3LiveSearch.helpList.remove(); - } - } - }; - this.hasIframeListeners = true; - }, this); - + handleBlur : function() { + TYPO3LiveSearch.hasFocus = false; + + if (TYPO3LiveSearch.getValue() == '') { + TYPO3LiveSearch.reset(); + } + + TYPO3LiveSearch.postBlur(); } }); @@ -310,4 +289,7 @@ }); TYPO3LiveSearch.applyToMarkup(Ext.get('live-search-box')); + + // Add a blur event listener outside the ExtJS widget to handle clicks in iframes also. + Ext.get('live-search-box').on('blur', TYPO3LiveSearch.handleBlur); });