Skip to content

Commit

Permalink
XWIKI-21729: Bad interaction between quick search and the drawer
Browse files Browse the repository at this point in the history
* Fired an event that was overwise unused
* Fixed its listener
* Added an optional argument for the suggest resetTimeout function (to allow a more precise control of the suggest panel)
  • Loading branch information
Sereza7 committed Feb 1, 2024
1 parent e59eb58 commit 82282c5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
globalSearch.addClass('globalsearch-close');
globalSearchButton.attr('aria-expanded', 'false');
globalSearchInput.attr('disabled','');
document.fire('xwiki:suggest:collapsed');
}

// Open the global search when the user click on the global search button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ var XWiki = (function (XWiki) {
* Callback triggered when the suggest element is collapsed, because of a focusout event for example.
*/
onSuggestCollapsed: function(event) {
this.suggest.clearSuggestions();
/* We match the collapse of the input field timing to close the suggest panel. */
this.suggest.resetTimeout(300);
},

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1033,11 +1033,14 @@ var XWiki = (function(XWiki){
/**
* Reset timeout
*/
resetTimeout: function()
resetTimeout: function(timeout)
{
if(!timeout) {
timeout = 1000;
}
clearTimeout(this.toID);
var pointer = this;
this.toID = setTimeout(function () { pointer.clearSuggestions() }, 1000);
this.toID = setTimeout(function () { pointer.clearSuggestions() }, timeout);
},

/**
Expand Down

0 comments on commit 82282c5

Please sign in to comment.