Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
dropdown_list_widget: Properly bind focus event to input field.
aryanshridhar2c50c67d079b
diff --git a/static/js/dropdown_list_widget.js b/static/js/dropdown_list_widget.jsindex d191e55aa1c..0c124f7faa8 100644--- a/static/js/dropdown_list_widget.js+++ b/static/js/dropdown_list_widget.js@@ -119,7 +119,13 @@ export const DropdownListWidget = function ({// On opening a Bootstrap Dropdown, the parent element receives focus.// Here, we want our search input to have focus instead.e.preventDefault();- search_input.trigger("focus");+ // This function gets called twice when focusing the+ // dropdown, and only in the second call is the input+ // field visible in the DOM; so the following visibility+ // check ensures we wait for the second call to focus.+ if (dropdown_list_body.is(":visible")) {+ search_input.trigger("focus");+ }});search_input.on("keydown", (e) => {