From a4c2327fa93dea705f74b6c0c6e39a382e5c9493 Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Sat, 30 Aug 2025 10:52:36 +0530 Subject: [PATCH] sidebar_ui: Extract selectors for left sidebar headers. --- web/src/sidebar_ui.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/web/src/sidebar_ui.ts b/web/src/sidebar_ui.ts index f4bd6d5faf..a46e175896 100644 --- a/web/src/sidebar_ui.ts +++ b/web/src/sidebar_ui.ts @@ -465,6 +465,17 @@ export function initialize_right_sidebar(): void { ); } +function get_header_rows_selectors(): string { + return ( + // Views header. + "#left-sidebar-navigation-area:not(.hidden-by-filters) #views-label-container, " + + // DM Headers + "#direct-messages-section-header, " + + // All channel headers. + ".stream-list-section-container:not(.no-display) .stream-list-subsection-header" + ); +} + function all_rows(): JQuery { // NOTE: This function is designed to be used for keyboard navigation purposes. // This function returns all the rows in the left sidebar. @@ -474,12 +485,7 @@ function all_rows(): JQuery { ".top_left_row, " + // All DM and channel rows. ".bottom_left_row, " + - // Views header. - "#left-sidebar-navigation-area:not(.hidden-by-filters) #views-label-container, " + - // DM Headers - "#direct-messages-section-header, " + - // All channel headers. - ".stream-list-section-container:not(.no-display) .stream-list-subsection-header", + get_header_rows_selectors(), ).not(".hidden-by-filters"); // Remove rows hidden due to being inactive or muted. const $inactive_or_muted_rows = $(