Clicking on a suggestion now submits the search form
authorMarcel Werk <burntime@woltlab.com>
Wed, 24 Aug 2016 10:41:08 +0000 (12:41 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 24 Aug 2016 10:41:12 +0000 (12:41 +0200)
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search/Page.js

index 522352a289df3955290cb139314062f3ccdab905..70ae1b6d811860e96308fa5003235a842bae3ea2 100644 (file)
@@ -1,4 +1,4 @@
-define(['Core', 'Dom/Util', 'Ui/SimpleDropdown', './Input'], function(Core, DomUtil, UiSimpleDropdown, UiSearchInput) {
+define(['Core', 'Dom/Traverse', 'Dom/Util', 'Ui/SimpleDropdown', './Input'], function(Core, DomTraverse, DomUtil, UiSimpleDropdown, UiSearchInput) {
        "use strict";
        
        return {
@@ -22,6 +22,13 @@ define(['Core', 'Dom/Util', 'Ui/SimpleDropdown', './Input'], function(Core, DomU
                                        var offsetRight = (DomUtil.offset(parent).left + parent.clientWidth) - (DomUtil.offset(searchInput).left + minWidth);
                                        var offsetTop = DomUtil.styleAsInt(window.getComputedStyle(parent), 'padding-bottom');
                                        dropdownMenu.style.setProperty('transform', 'translateX(-' + Math.ceil(offsetRight) + 'px) translateY(-' + offsetTop + 'px)', '');
+                               },
+                               callbackSelect: function() {
+                                       setTimeout(function() {
+                                               DomTraverse.parentByTag(searchInput, 'FORM').submit();
+                                       }, 1);
+                                       
+                                       return true;
                                }
                        });