Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

connection_error_banner: Hide loading indicator on hover.

Sayam Samal987bde8cd31c
diff --git a/web/src/buttons.ts b/web/src/buttons.ts
index 402530e405a..06f576d2d12 100644
--- a/web/src/buttons.ts
+++ b/web/src/buttons.ts
@@ -7,8 +7,7 @@ export function show_button_loading_indicator($button: JQuery): void {
if ($button.find(".button-loading-indicator").length > 0) {
return;
}
- // First, we disable the button and hide its contents.
- $button.prop("disabled", true);
+ // First, we hide the current content of the button.
$button.find(".zulip-icon").css("visibility", "hidden");
$button.find(".action-button-label").css("visibility", "hidden");
// Next, we create a loading indicator with a unique id.
diff --git a/web/src/popup_banners.ts b/web/src/popup_banners.ts
index 46c45570739..14b01e00788 100644
--- a/web/src/popup_banners.ts
+++ b/web/src/popup_banners.ts
@@ -103,7 +103,17 @@ export function open_connection_error_popup_banner(opts: {
e.preventDefault();
e.stopPropagation();
- buttons.show_button_loading_indicator($(this));
+ const $button = $(this);
+
+ // If the loading indicator is already being shown, this logic
+ // allows us to visually indicate that the retry sequence was
+ // executed again by showing the loading indicator on click.
+ $button.removeClass("button-hide-loading-indicator-on-hover");
+ $button.one("mouseleave", () => {
+ $button.addClass("button-hide-loading-indicator-on-hover");
+ });
+
+ buttons.show_button_loading_indicator($button);
opts.on_retry_callback();
});
}
diff --git a/web/styles/buttons.css b/web/styles/buttons.css
index 8c9bdd49938..ce0d19d2760 100644
--- a/web/styles/buttons.css
+++ b/web/styles/buttons.css
@@ -607,3 +607,14 @@
}
}
}
+
+.button-hide-loading-indicator-on-hover:hover {
+ .button-loading-indicator {
+ visibility: hidden;
+ }
+
+ .action-button-label,
+ .zulip-icon {
+ visibility: visible !important;
+ }
+}