MDL-51919 forms lib: Autocomplete doesn't hide prematurely.
authorAdrian Greeve <adrian@moodle.com>
Wed, 28 Oct 2015 02:36:15 +0000 (10:36 +0800)
committerAdrian Greeve <adrian@moodle.com>
Wed, 28 Oct 2015 06:15:26 +0000 (14:15 +0800)
Quickly navigating via the keyboard to an autocomplete
element and hitting down would result in the selections
being displayed and then quickly removed. This has now
been fixed.

lib/amd/build/form-autocomplete.min.js
lib/amd/src/form-autocomplete.js

index bced484..1fabc2a 100644 (file)
Binary files a/lib/amd/build/form-autocomplete.min.js and b/lib/amd/build/form-autocomplete.min.js differ
index 70eb9de..48d3290 100644 (file)
@@ -585,10 +585,12 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
                 window.clearTimeout(closeSuggestionsTimer);
             }
             closeSuggestionsTimer = window.setTimeout(function() {
-                if ((e.type == 'blur') && tags) {
-                    createItem(inputId, suggestionsId, selectionId, multiple, originalSelect);
+                if (e.type == 'blur') {
+                    if (tags) {
+                        createItem(inputId, suggestionsId, selectionId, multiple, originalSelect);
+                    }
+                    closeSuggestions(inputId, suggestionsId, selectionId);
                 }
-                closeSuggestions(inputId, suggestionsId, selectionId);
             }, 500);
         });
         var arrowElement = $(document.getElementById(downArrowId));