diff --git a/help/user-list.md b/help/user-list.md
index 5d78d52f7b..6cdc613668 100644
--- a/help/user-list.md
+++ b/help/user-list.md
@@ -23,11 +23,7 @@ distraction, you can hide the user list any time.
class="zulip-icon zulip-icon-triple-users"> ) icon in the upper right to
show it.
-1. Click the **search** () icon at the top of the right sidebar to open the
- search box.
-
-1. Type the name of the user you are looking for.
+1. Type the name of the user you are looking for in the search box.
!!! keyboard_tip ""
diff --git a/web/e2e-tests/message-basics.test.ts b/web/e2e-tests/message-basics.test.ts
index 7bcc170670..eceed790ba 100644
--- a/web/e2e-tests/message-basics.test.ts
+++ b/web/e2e-tests/message-basics.test.ts
@@ -429,7 +429,7 @@ async function test_users_search(page: Page): Promise {
await assert_in_list(page, "aaron");
// Enter the search box and test selected suggestion navigation
- await page.click("#user_filter_icon");
+ await page.click(".user-list-filter");
await page.waitForSelector("#buddy-list-other-users .highlighted_user", {visible: true});
await assert_selected(page, "Desdemona");
await assert_not_selected(page, "Cordelia, Lear's daughter");
diff --git a/web/src/activity_ui.ts b/web/src/activity_ui.ts
index cd49215a90..7148b8077f 100644
--- a/web/src/activity_ui.ts
+++ b/web/src/activity_ui.ts
@@ -212,7 +212,7 @@ export function narrow_for_user_id(opts: {user_id: number}): void {
assert(narrow_by_email);
narrow_by_email(email);
assert(user_filter !== undefined);
- user_filter.clear_and_hide_search();
+ user_filter.clear_search();
}
function keydown_enter_key(): void {
@@ -274,9 +274,9 @@ export function initiate_search(): void {
}
}
-export function escape_search(): void {
+export function clear_search(): void {
if (user_filter) {
- user_filter.clear_and_hide_search();
+ user_filter.clear_search();
}
}
diff --git a/web/src/buddy_list.ts b/web/src/buddy_list.ts
index ca16f19deb..82378a3974 100644
--- a/web/src/buddy_list.ts
+++ b/web/src/buddy_list.ts
@@ -77,7 +77,6 @@ type BuddyListRenderData = {
pm_ids_set: Set;
total_human_subscribers_count: number;
other_users_count: number;
- total_human_users: number;
hide_headers: boolean;
all_participant_ids: Set;
};
@@ -87,8 +86,7 @@ function get_render_data(): BuddyListRenderData {
const pm_ids_set = narrow_state.pm_ids_set();
const total_human_subscribers_count = get_total_human_subscriber_count(current_sub, pm_ids_set);
- const total_human_users = people.get_active_human_count();
- const other_users_count = total_human_users - total_human_subscribers_count;
+ const other_users_count = people.get_active_human_count() - total_human_subscribers_count;
const hide_headers = should_hide_headers(current_sub, pm_ids_set);
const all_participant_ids = buddy_data.get_conversation_participants();
@@ -97,7 +95,6 @@ function get_render_data(): BuddyListRenderData {
pm_ids_set,
total_human_subscribers_count,
other_users_count,
- total_human_users,
hide_headers,
all_participant_ids,
};
@@ -247,9 +244,8 @@ export class BuddyList extends BuddyListConf {
);
}
} else {
- const total_human_users = people.get_active_human_count();
const other_users_count =
- total_human_users - total_human_subscribers_count;
+ people.get_active_human_count() - total_human_subscribers_count;
tooltip_text = $t(
{
defaultMessage:
@@ -429,8 +425,7 @@ export class BuddyList extends BuddyListConf {
}
this.current_filter = narrow_state.filter();
- const {current_sub, total_human_subscribers_count, other_users_count, total_human_users} =
- this.render_data;
+ const {current_sub, total_human_subscribers_count, other_users_count} = this.render_data;
$(".buddy-list-subsection-header").empty();
// If we're in the mode of hiding headers, that means we're only showing the "other users"
@@ -446,16 +441,9 @@ export class BuddyList extends BuddyListConf {
$("#buddy-list-users-matching-view-container").toggleClass("no-display", true);
}
- // Usually we show the user counts in the headers, but if we're hiding
- // those headers then we show the total user count in the main title.
- const default_userlist_title = $t({defaultMessage: "USERS"});
if (hide_headers) {
- const formatted_count = get_formatted_sub_count(total_human_users);
- const userlist_title = `${default_userlist_title} (${formatted_count})`;
- $("#userlist-title").text(userlist_title);
return;
}
- $("#userlist-title").text(default_userlist_title);
let header_text;
if (current_sub) {
diff --git a/web/src/hotkey.js b/web/src/hotkey.js
index 0c6fb3f2ef..735a9bbaf7 100644
--- a/web/src/hotkey.js
+++ b/web/src/hotkey.js
@@ -306,7 +306,7 @@ export function process_escape_key(e) {
if (processing_text()) {
if (activity_ui.searching()) {
- activity_ui.escape_search();
+ activity_ui.clear_search();
return true;
}
diff --git a/web/src/resize.ts b/web/src/resize.ts
index 52ddfabf02..53b12e694a 100644
--- a/web/src/resize.ts
+++ b/web/src/resize.ts
@@ -33,8 +33,7 @@ function get_new_heights(): {
const usable_height =
viewport_height -
Number.parseInt($("#right-sidebar").css("paddingTop"), 10) -
- ($("#userlist-header").outerHeight(true) ?? 0) -
- ($("#user_search_section:not(.notdisplayed)").outerHeight(true) ?? 0);
+ ($("#userlist-header").outerHeight(true) ?? 0);
const buddy_list_wrapper_max_height = Math.max(80, usable_height);
diff --git a/web/src/tippyjs.ts b/web/src/tippyjs.ts
index d2c6f1d5b0..8079251829 100644
--- a/web/src/tippyjs.ts
+++ b/web/src/tippyjs.ts
@@ -698,6 +698,7 @@ export function initialize(): void {
tippy.delegate("body", {
target: "#userlist-header-search",
+ delay: LONG_HOVER_DELAY,
placement: "top",
appendTo: () => document.body,
onShow(instance) {
diff --git a/web/src/user_search.ts b/web/src/user_search.ts
index e66ea11dad..4898942eef 100644
--- a/web/src/user_search.ts
+++ b/web/src/user_search.ts
@@ -3,7 +3,6 @@ import assert from "minimalistic-assert";
import * as buddy_data from "./buddy_data";
import * as popovers from "./popovers";
-import * as resize from "./resize";
import * as sidebar_ui from "./sidebar_ui";
export class UserSearch {
@@ -11,7 +10,7 @@ export class UserSearch {
// above the buddy list. We rely on other code to manage the
// details of populating the list when we change.
- $widget = $("#user_search_section").expectOne();
+ $widget = $("#userlist-header-search").expectOne();
$input = $("input.user-list-filter").expectOne();
_reset_items: () => void;
_update_list: () => void;
@@ -25,12 +24,11 @@ export class UserSearch {
$("#clear_search_people_button").on("click", () => {
this.clear_search();
});
- $("#userlist-header-search").on("click", () => {
- this.toggle_filter_displayed();
- });
this.$input.on("input", () => {
- buddy_data.set_is_searching_users(this.$input.val() !== "");
+ const input_is_empty = this.$input.val() === "";
+ buddy_data.set_is_searching_users(!input_is_empty);
+ $("#clear_search_people_button").toggleClass("hidden", input_is_empty);
opts.update_list();
});
this.$input.on("focus", (e) => {
@@ -52,54 +50,17 @@ export class UserSearch {
return this.$input.is(":focus");
}
- empty(): boolean {
- return this.text() === "";
- }
-
// This clears search input but doesn't close
// the search widget unless it was already empty.
clear_search(): void {
buddy_data.set_is_searching_users(false);
-
- if (this.empty()) {
- this.close_widget();
- return;
- }
+ $("#clear_search_people_button").toggleClass("hidden", true);
this.$input.val("");
this.$input.trigger("blur");
this._reset_items();
}
- // This always clears and closes search.
- clear_and_hide_search(): void {
- this.clear_search();
- this._update_list();
- this.close_widget();
- }
-
- hide_widget(): void {
- this.$widget.addClass("notdisplayed");
- resize.resize_sidebars();
- }
-
- show_widget(): void {
- // Hide all the popovers.
- popovers.hide_all();
- this.$widget.removeClass("notdisplayed");
- resize.resize_sidebars();
- }
-
- widget_shown(): boolean {
- return this.$widget.hasClass("notdisplayed");
- }
-
- close_widget(): void {
- this.$input.trigger("blur");
- this.hide_widget();
- this._reset_items();
- }
-
expand_column(): void {
const $column = this.$input.closest(".app-main [class^='column-']");
if (!$column.hasClass("expanded")) {
@@ -114,21 +75,12 @@ export class UserSearch {
initiate_search(): void {
this.expand_column();
- this.show_widget();
// Needs to be called when input is visible after fix_invite_user_button_flicker.
setTimeout(() => {
this.$input.trigger("focus");
}, 0);
}
- toggle_filter_displayed(): void {
- if (this.widget_shown()) {
- this.initiate_search();
- } else {
- this.clear_and_hide_search();
- }
- }
-
on_focus(e: JQuery.FocusEvent): void {
this._on_focus();
e.stopPropagation();
diff --git a/web/styles/right_sidebar.css b/web/styles/right_sidebar.css
index ba32252d0a..60be2c9d61 100644
--- a/web/styles/right_sidebar.css
+++ b/web/styles/right_sidebar.css
@@ -363,37 +363,59 @@ $user_status_emoji_width: 24px;
grid-template-rows: var(--line-height-sidebar-row-prominent);
grid-template-columns: minmax(0, 1fr) auto;
align-items: center;
+ margin-bottom: 10px;
#userlist-header-search {
display: grid;
grid-template-rows: var(--line-height-sidebar-row-prominent);
- grid-template-columns: minmax(0, 1fr) 20px;
+ grid-template-columns: minmax(0, 1fr) 30px;
align-items: center;
- }
- #userlist-title {
- margin: 0;
- }
+ & .user-list-filter {
+ grid-area: 1 / 1 / 2 / 3;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ /* Prevent text from colliding with #clear_search_button */
+ padding-right: 28px;
+ height: var(--line-height-sidebar-row-prominent);
+ box-sizing: border-box;
+ }
- #user_filter_icon {
- opacity: 0.5;
- justify-self: center;
+ #clear_search_people_button {
+ grid-area: 1 / 2 / 2 / 3;
+ padding: 0;
+ background: none;
+ color: var(--color-text-clear-search-button);
+ display: grid;
- &:hover {
- opacity: 1;
- cursor: pointer;
+ &:hover {
+ color: var(--color-text-clear-search-button-hover);
+ }
+
+ &:focus,
+ &:focus-visible,
+ &:active {
+ box-shadow: none;
+ outline: none;
+ }
+
+ .zulip-icon-close {
+ align-self: center;
+ }
}
}
- /* hovering over the userlist-header creates the same highlight effect as hovering over the user_filter_icon */
- &:hover > #user_filter_icon {
- opacity: 1;
- cursor: pointer;
- }
-
#buddy-list-menu-icon {
+ color: var(--color-vdots-visible);
justify-content: center;
display: grid;
+ width: 25px;
+ margin-left: 5px;
+
+ &:hover {
+ color: var(--color-vdots-hover);
+ }
}
}
@@ -407,29 +429,3 @@ $user_status_emoji_width: 24px;
from the legacy value. */
margin-top: calc(25px - (var(--legacy-body-line-height-unitless) * 1em));
}
-
-#user_search_section {
- display: grid;
- grid-template-columns: minmax(0, 1fr) 28px;
- grid-template-rows: var(--line-height-sidebar-row-prominent);
- white-space: nowrap;
- margin-bottom: 10px;
-
- & .user-list-filter {
- grid-area: 1 / 1 / 2 / 3;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- /* Prevent text from colliding with .clear_search_button */
- padding-right: 28px;
- /* Push back against inherited styles; let CSS Grid be in
- charge of the height. */
- height: auto;
- }
-
- .clear_search_button {
- grid-area: 1 / 2 / 2 / 3;
- position: static;
- padding: 0;
- }
-}
diff --git a/web/templates/right_sidebar.hbs b/web/templates/right_sidebar.hbs
index 7d6e80d695..157a64a2f2 100644
--- a/web/templates/right_sidebar.hbs
+++ b/web/templates/right_sidebar.hbs
@@ -2,22 +2,16 @@