mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 00:46:03 +00:00
recent_topics: Set focus to filter button after click.
Since, the filter button is replaced with a different button after click, the `current_focus_elem` points at incorrect element. `revive_current_focus` follows a good method to locate the filter button, hence we use it to correct the element `current_focus_elem` points at.
This commit is contained in:
@@ -418,6 +418,7 @@ export function initialize() {
|
|||||||
recent_topics_ui.change_focused_element($(e.target), "click");
|
recent_topics_ui.change_focused_element($(e.target), "click");
|
||||||
recent_topics_ui.set_filter(e.currentTarget.dataset.filter);
|
recent_topics_ui.set_filter(e.currentTarget.dataset.filter);
|
||||||
recent_topics_ui.update_filters_view();
|
recent_topics_ui.update_filters_view();
|
||||||
|
recent_topics_ui.revive_current_focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("body").on("click", "td.recent_topic_stream", (e) => {
|
$("body").on("click", "td.recent_topic_stream", (e) => {
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ export function get_focused_row_message() {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function revive_current_focus() {
|
export function revive_current_focus() {
|
||||||
// After re-render, the current_focus_elem is no longer linked
|
// After re-render, the current_focus_elem is no longer linked
|
||||||
// to the focused element, this function attempts to revive the
|
// to the focused element, this function attempts to revive the
|
||||||
// link and focus to the element prior to the rerender.
|
// link and focus to the element prior to the rerender.
|
||||||
|
|||||||
Reference in New Issue
Block a user