Skip to content

Commit 1d8b2b1

Browse files
authored
fix(dropdown): fix menu show on mobile and api call
When a search dropdown was used, loading remote content via apiSettings, the menu did not show up on mobile devices. This was due to the lost search focus which happened when the menu nodes were recreated after the api returned the dropdown items. Mobile devices triggered a blur of the search field, while desktop browsers did not. Blurring the search field however led to not showing the dropdown menu anymore. This PR also fixes that the API was called twice the first time one clicked on the search field (while it was only triggered once when clicking on the dropdown icon)
1 parent d5a27ef commit 1d8b2b1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/definitions/modules/dropdown.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ $.fn.dropdown = function(parameters) {
569569
module.unbind.intent();
570570
}
571571
iconClicked = false;
572+
focused = false;
572573
},
573574

574575
hideOthers: function() {
@@ -784,6 +785,7 @@ $.fn.dropdown = function(parameters) {
784785
;
785786
});
786787
}
788+
module.focusSearch(true);
787789
afterFiltered();
788790
});
789791
}
@@ -1127,7 +1129,7 @@ $.fn.dropdown = function(parameters) {
11271129
if(module.is.multiple()) {
11281130
module.remove.activeLabel();
11291131
}
1130-
if(!module.is.active() && (settings.showOnFocus || (event.type !== 'focus' && event.type !== 'focusin'))) {
1132+
if(!focused && !module.is.active() && (settings.showOnFocus || (event.type !== 'focus' && event.type !== 'focusin'))) {
11311133
focused = true;
11321134
module.search();
11331135
}

0 commit comments

Comments
 (0)