mirror of https://github.com/zulip/zulip.git
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:
parent
fc251fd464
commit
35433c02b3
|
@ -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");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue