mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
stream_list: Fix focus behavior for topic list search box.
This commit ensures that the focus on the topic list search box is only triggered when the user clicks on the "SHOW ALL TOPICS" button, and not when the narrow changes. This prevents unwanted focus behavior when switching between different narrows/views which interfered with the focus states of the compose box.
This commit is contained in:
@@ -468,7 +468,6 @@ export function zoom_in_topics(options: {stream_id: number | undefined}): void {
|
||||
$elt.toggleClass("hide", false);
|
||||
// Add search box for topics list.
|
||||
$elt.children("div.bottom_left_row").append($(render_filter_topics()));
|
||||
$("#topic_filter_query").trigger("focus");
|
||||
topic_list.setup_topic_search_typeahead();
|
||||
} else {
|
||||
$elt.toggleClass("hide", true);
|
||||
@@ -896,6 +895,11 @@ export function initialize({
|
||||
|
||||
$("#stream_filters").on("click", ".show-more-topics", (e) => {
|
||||
zoom_in();
|
||||
// We define the focus behavior for the topic list search box
|
||||
// outside of the `zoom_in` method, since we want the focus
|
||||
// to only happen when the user clicks on the "SHOW ALL TOPICS"
|
||||
// button, and not interfere with the narrow change handling.
|
||||
$("#topic_filter_query").trigger("focus");
|
||||
browser_history.update_current_history_state_data({show_more_topics: true});
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user