diff --git a/web/src/dropdown_list_widget.js b/web/src/dropdown_list_widget.js index 34a0b3e407..7c524cb737 100644 --- a/web/src/dropdown_list_widget.js +++ b/web/src/dropdown_list_widget.js @@ -201,6 +201,14 @@ export class DropdownListWidget { break; } } + + if (keydown_util.is_enter_event(e) && e.target === $search_input[0]) { + e.stopPropagation(); + e.preventDefault(); + // Select the first option from the menu on pressing + // "Enter" when focus is on the search input. + dropdown_elements().first().trigger("click"); + } }); } @@ -525,6 +533,14 @@ export class MultiSelectDropdownListWidget extends DropdownListWidget { break; } } + + if (keydown_util.is_enter_event(e) && e.target === $search_input[0]) { + e.stopPropagation(); + e.preventDefault(); + // Select the first option from the menu on pressing + // "Enter" when focus is on the search input. + dropdown_elements().first().trigger("click"); + } }); }