mirror of
https://github.com/zulip/zulip.git
synced 2025-10-29 19:13:53 +00:00
dropdown_list_widget: Select first option on pressing enter in search.
This commit updates the code for MultiSelectDropdownListWidget and DropdownListWidget components to select the first option on pressing enter when focus is on search input. Fixes #25024.
This commit is contained in:
@@ -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");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user