From 2a53a9fbd02ff40074fbefcdf03e23ee57f693c3 Mon Sep 17 00:00:00 2001 From: Jack Lukic Date: Tue, 4 Apr 2017 14:39:46 -0400 Subject: [PATCH] Fix searchdelay could make results appear even after search has lost focus --- RELEASE-NOTES.md | 6 ++++++ src/definitions/modules/search.js | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 3fc8460bb..ea30f7b91 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,5 +1,11 @@ ## RELEASE NOTES +### Version 2.2.11 - March 28, 2017 + +**Bugs** +- **Search** - Fixed issue where `searchDelay` could cause results to appear after search had lost focus. +- **Sticky** - Fix issue where sticky would cause page to shift when `context` height was determined by sticky's height in `position: static;` #3430 + ### Version 2.2.10 - March 28, 2017 **Critical Bugs** diff --git a/src/definitions/modules/search.js b/src/definitions/modules/search.js index e2b8615e1..2e7898126 100644 --- a/src/definitions/modules/search.js +++ b/src/definitions/modules/search.js @@ -144,7 +144,16 @@ $.fn.search = function(parameters) { event: { input: function() { clearTimeout(module.timer); - module.timer = setTimeout(module.query, settings.searchDelay); + if(settings.searchDelay) { + module.timer = setTimeout(function() { + if(module.is.focused()) { + module.query(); + } + }, settings.searchDelay); + } + else { + module.query(); + } }, focus: function() { module.set.focus();