mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
left_sidebar: Standardize channel list filter input.
This follow-up commit replaces the current left sidebar channel list filter input implementation with the redesigned input component. Note: This commit removes `clear_search` method from `stream_list.ts`, since the `.input-button` onclick handler over at `inputs.ts` handles the clearing of the filter input fields by sending an empty text input event. This input event triggers the filter update handler of the module, in this case the `update_streams_for_search` function and resets the filter list, eliminating the need for a separate per-module input clearing/resetting workflow. Fixes part of #34476.
This commit is contained in:
@@ -973,13 +973,14 @@ export function set_event_handlers({
|
||||
}
|
||||
});
|
||||
|
||||
$("#clear_search_stream_button").on("click", clear_search);
|
||||
|
||||
$("#streams_header")
|
||||
.expectOne()
|
||||
.on("click", (e) => {
|
||||
e.preventDefault();
|
||||
if (e.target.id === "streams_inline_icon") {
|
||||
if (
|
||||
e.target.id === "streams_inline_icon" ||
|
||||
$(e.target).parent().hasClass("input-button")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
toggle_filter_displayed(e);
|
||||
@@ -1054,13 +1055,8 @@ export function searching(): boolean {
|
||||
return $(".stream-list-filter").expectOne().is(":focus");
|
||||
}
|
||||
|
||||
export function clear_search(e: JQuery.ClickEvent): void {
|
||||
e.stopPropagation();
|
||||
export function test_clear_search(): void {
|
||||
const $filter = $(".stream-list-filter").expectOne();
|
||||
if ($filter.val() === "") {
|
||||
clear_and_hide_search();
|
||||
return;
|
||||
}
|
||||
$filter.val("");
|
||||
$filter.trigger("blur");
|
||||
update_streams_for_search();
|
||||
|
||||
Reference in New Issue
Block a user