diff --git a/frontend_tests/node_tests/hashchange.js b/frontend_tests/node_tests/hashchange.js index 4aa98cec2e..b124fb2f08 100644 --- a/frontend_tests/node_tests/hashchange.js +++ b/frontend_tests/node_tests/hashchange.js @@ -137,10 +137,6 @@ function test_helper({override, change_tab}) { stub(ui_report, "error"); if (change_tab) { - override(ui_util, "change_tab_to", (hash) => { - events.push("change_tab_to " + hash); - }); - override(narrow, "activate", (terms) => { narrow_terms = terms; events.push("narrow.activate"); @@ -190,7 +186,6 @@ run_test("hash_interactions", ({override}) => { helper.assert_events([ [overlays, "close_for_hash_change"], [message_viewport, "stop_auto_scrolling"], - "change_tab_to #message_feed_container", [narrow, "deactivate"], [floating_recipient_bar, "update"], ]); @@ -200,7 +195,6 @@ run_test("hash_interactions", ({override}) => { helper.assert_events([ [overlays, "close_for_hash_change"], [message_viewport, "stop_auto_scrolling"], - "change_tab_to #message_feed_container", [narrow, "deactivate"], [floating_recipient_bar, "update"], ]); @@ -225,7 +219,6 @@ run_test("hash_interactions", ({override}) => { helper.assert_events([ [overlays, "close_for_hash_change"], [message_viewport, "stop_auto_scrolling"], - "change_tab_to #message_feed_container", "narrow.activate", [floating_recipient_bar, "update"], ]); @@ -239,7 +232,6 @@ run_test("hash_interactions", ({override}) => { helper.assert_events([ [overlays, "close_for_hash_change"], [message_viewport, "stop_auto_scrolling"], - "change_tab_to #message_feed_container", "narrow.activate", [floating_recipient_bar, "update"], ]); @@ -254,7 +246,6 @@ run_test("hash_interactions", ({override}) => { helper.assert_events([ [overlays, "close_for_hash_change"], [message_viewport, "stop_auto_scrolling"], - "change_tab_to #message_feed_container", [ui_report, "error"], ]); diff --git a/frontend_tests/node_tests/narrow_activate.js b/frontend_tests/node_tests/narrow_activate.js index e52a74c2c1..7e49ce09e3 100644 --- a/frontend_tests/node_tests/narrow_activate.js +++ b/frontend_tests/node_tests/narrow_activate.js @@ -35,7 +35,6 @@ const search = mock_esm("../../static/js/search"); const stream_list = mock_esm("../../static/js/stream_list"); const top_left_corner = mock_esm("../../static/js/top_left_corner"); const typing_events = mock_esm("../../static/js/typing_events"); -const ui_util = mock_esm("../../static/js/ui_util"); const unread_ops = mock_esm("../../static/js/unread_ops"); mock_esm("../../static/js/recent_topics_util", { is_visible() {}, @@ -90,7 +89,6 @@ function test_helper() { stub(top_left_corner, "handle_narrow_activated"); stub(typing_events, "render_notifications_for_narrow"); stub(compose_actions, "update_narrow_to_recipient_visibility"); - stub(ui_util, "change_tab_to"); stub(unread_ops, "process_visible"); stub(compose_closed_ui, "update_buttons_for_stream"); stub(compose_closed_ui, "update_buttons_for_private"); @@ -192,7 +190,6 @@ run_test("basics", () => { [message_scroll, "hide_indicators"], [notifications, "clear_compose_notifications"], [notifications, "redraw_title"], - [ui_util, "change_tab_to"], [unread_ops, "process_visible"], [hashchange, "save_narrow"], [compose_closed_ui, "update_buttons_for_stream"], diff --git a/frontend_tests/node_tests/search_future.js b/frontend_tests/node_tests/search_future.js index c6675245a1..038d2acb3a 100644 --- a/frontend_tests/node_tests/search_future.js +++ b/frontend_tests/node_tests/search_future.js @@ -21,7 +21,6 @@ mock_esm("../../static/js/search_pill_widget", { }, }); mock_esm("../../static/js/ui_util", { - change_tab_to: noop, place_caret_at_end: noop, }); diff --git a/frontend_tests/node_tests/search_now.js b/frontend_tests/node_tests/search_now.js index a85a9b8323..700da3f123 100644 --- a/frontend_tests/node_tests/search_now.js +++ b/frontend_tests/node_tests/search_now.js @@ -9,14 +9,9 @@ const {page_params} = require("../zjsunit/zpage_params"); page_params.search_pills_enabled = false; -const noop = () => {}; - const narrow = mock_esm("../../static/js/narrow"); const narrow_state = mock_esm("../../static/js/narrow_state"); const search_suggestion = mock_esm("../../static/js/search_suggestion"); -mock_esm("../../static/js/ui_util", { - change_tab_to: noop, -}); const Filter = {}; diff --git a/static/js/gear_menu.js b/static/js/gear_menu.js index 870f7f5691..9251e369b3 100644 --- a/static/js/gear_menu.js +++ b/static/js/gear_menu.js @@ -2,10 +2,7 @@ import $ from "jquery"; import render_gear_menu from "../templates/gear_menu.hbs"; -import * as hashchange from "./hashchange"; import {$t} from "./i18n"; -import * as message_viewport from "./message_viewport"; -import * as navigate from "./navigate"; import {page_params} from "./page_params"; import * as settings_data from "./settings_data"; @@ -80,15 +77,8 @@ in static/js/info_overlay.js. They are dispatched using a click handler in static/js/click_handlers.js. The click handler uses "[data-overlay-trigger]" as the selector and then calls browser_history.go_to_location. - */ -// We want to remember how far we were scrolled on each 'tab'. -// To do so, we need to save away the old position of the -// scrollbar when we switch to a new tab (and restore it -// when we switch back.) -const scroll_positions = new Map(); - export function update_org_settings_menu_item() { const $item = $(".admin-menu-item").expectOne(); if (page_params.is_admin) { @@ -156,38 +146,6 @@ export function initialize() { }); $("#navbar-buttons").html(rendered_gear_menu); update_org_settings_menu_item(); - - $('#gear-menu a[data-toggle="tab"]').on("show", (e) => { - // Save the position of our old tab away, before we switch - const old_tab = $(e.relatedTarget).attr("href"); - scroll_positions.set(old_tab, message_viewport.scrollTop()); - }); - $('#gear-menu a[data-toggle="tab"]').on("shown", (e) => { - const target_tab = $(e.target).attr("href"); - // Hide all our error messages when switching tabs - $(".alert").removeClass("show"); - - // Set the URL bar title to show the sub-page you're currently on. - let browser_url = target_tab; - if (browser_url === "#message_feed_container") { - browser_url = ""; - } - hashchange.changehash(browser_url); - - // After we show the new tab, restore its old scroll position - // (we apparently have to do this after setting the hash, - // because otherwise that action may scroll us somewhere.) - if (target_tab === "#message_feed_container") { - if (scroll_positions.has(target_tab)) { - message_viewport.scrollTop(scroll_positions.get(target_tab)); - } else { - navigate.scroll_to_selected(); - } - } - }); - - // The admin and settings pages are generated client-side through - // templates. } export function open() { diff --git a/static/js/hashchange.js b/static/js/hashchange.js index 75de905001..2ea35305b0 100644 --- a/static/js/hashchange.js +++ b/static/js/hashchange.js @@ -26,7 +26,6 @@ import * as spectators from "./spectators"; import * as stream_settings_ui from "./stream_settings_ui"; import * as top_left_corner from "./top_left_corner"; import * as ui_report from "./ui_report"; -import * as ui_util from "./ui_util"; import * as user_groups_settings_ui from "./user_groups_settings_ui"; import {user_settings} from "./user_settings"; @@ -91,7 +90,6 @@ export function save_narrow(operators) { function show_all_message_view() { const coming_from_recent_topics = maybe_hide_recent_topics(); - ui_util.change_tab_to("#message_feed_container"); narrow.deactivate(coming_from_recent_topics); top_left_corner.handle_narrow_deactivated(); floating_recipient_bar.update(); @@ -138,7 +136,6 @@ function do_hashchange_normal(from_reload) { switch (hash[0]) { case "#narrow": { maybe_hide_recent_topics(); - ui_util.change_tab_to("#message_feed_container"); let operators; try { // TODO: Show possible valid URLs to the user. diff --git a/static/js/narrow.js b/static/js/narrow.js index 94ebc3a148..17968af29b 100644 --- a/static/js/narrow.js +++ b/static/js/narrow.js @@ -39,7 +39,6 @@ import * as stream_list from "./stream_list"; import * as top_left_corner from "./top_left_corner"; import * as topic_generator from "./topic_generator"; import * as typing_events from "./typing_events"; -import * as ui_util from "./ui_util"; import * as unread from "./unread"; import * as unread_ops from "./unread_ops"; import * as unread_ui from "./unread_ui"; @@ -489,7 +488,6 @@ export function activate(raw_operators, opts) { $("#zfilt").addClass("focused_table"); $("#zhome").removeClass("focused_table"); - ui_util.change_tab_to("#message_feed_container"); message_list.set_narrowed(msg_list); message_lists.set_current(message_list.narrowed); diff --git a/static/js/search.js b/static/js/search.js index 8de5d117de..50f06ea1f2 100644 --- a/static/js/search.js +++ b/static/js/search.js @@ -24,7 +24,6 @@ export function narrow_or_search_for_term(search_string) { // while using input tool return $search_query_box.val(); } - ui_util.change_tab_to("#message_feed_container"); let operators; if (page_params.search_pills_enabled) { diff --git a/static/js/ui_util.ts b/static/js/ui_util.ts index 81a0e501e7..bf39984512 100644 --- a/static/js/ui_util.ts +++ b/static/js/ui_util.ts @@ -5,10 +5,6 @@ import * as keydown_util from "./keydown_util"; // Add functions to this that have no non-trivial // dependencies other than jQuery. -export function change_tab_to(tabname: string): void { - $(`#gear-menu a[href="${CSS.escape(tabname)}"]`).tab("show"); -} - // https://stackoverflow.com/questions/4233265/contenteditable-set-caret-at-the-end-of-the-text-cross-browser export function place_caret_at_end(el: HTMLElement): void { el.focus(); diff --git a/static/styles/zulip.css b/static/styles/zulip.css index aad1960360..5f61579db9 100644 --- a/static/styles/zulip.css +++ b/static/styles/zulip.css @@ -546,6 +546,10 @@ p.n-margin { .column-middle { min-height: 100%; + + .column-middle-inner { + overflow: auto; + } } } diff --git a/static/templates/gear_menu.hbs b/static/templates/gear_menu.hbs index fdf3ed3724..98a4eeb812 100644 --- a/static/templates/gear_menu.hbs +++ b/static/templates/gear_menu.hbs @@ -4,10 +4,6 @@