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.

alerts: Improve styles, behavior between app and portico.

Karl Stolleybb09222662da
diff --git a/templates/zerver/app/index.html b/templates/zerver/app/index.html
index ac5582726b9..dc4d23586da 100644
--- a/templates/zerver/app/index.html
+++ b/templates/zerver/app/index.html
@@ -180,7 +180,7 @@
<source class="notification-sound-source-mp3" type="audio/mpeg" />
</audio>
-<div class="alert-box">
+<div class="alert-box app-alert-box">
<div id="popup_banners_wrapper" class="banner-wrapper">
<div class="alert alert_sidebar alert-error home-error-bar" id="zephyr-mirror-error">
<div class="exit"></div>
diff --git a/web/src/alert_popup.ts b/web/src/alert_popup.ts
index bac1718b30c..81f12139cba 100644
--- a/web/src/alert_popup.ts
+++ b/web/src/alert_popup.ts
@@ -1,8 +1,8 @@
import $ from "jquery";
// this will hide the alerts that you click "x" on.
-$("body").on("click", ".alert-box > div .exit", function () {
- const $alert = $(this).closest(".alert-box > div");
+$("body").on("click", ".alert-box .exit", function () {
+ const $alert = $(this).parent("div");
$alert.addClass("fade-out");
setTimeout(() => {
$alert.removeClass("fade-out show");
diff --git a/web/styles/alerts.css b/web/styles/alerts.css
index 87c53f1a6e1..d7ee6c74386 100644
--- a/web/styles/alerts.css
+++ b/web/styles/alerts.css
@@ -37,6 +37,22 @@
}
/* alert box component changes */
+
+/* We preserve the flexbox styles here for the .alert-box
+ in the portico; otherwise, we move them into the inner
+ .banner-wrapper to preserve the correct stacking of
+ alerts and banner display. */
+.alert-box:not(.app-alert-box),
+.app-alert-box .banner-wrapper {
+ display: flex;
+ /* Using column-reverse flex direction enables a stack-like
+ behavior where the most recent alert is always on top. */
+ flex-direction: column-reverse;
+ align-items: center;
+ justify-content: center;
+ gap: 5px;
+}
+
.alert-box {
/* We define this variable in web/styles/app_variables.css,
but we need to redefine it here since this is shared
@@ -51,13 +67,6 @@
/* Offset to account for the top padding + 5px from the top. */
top: calc(5px + (-1 * var(--popup-banner-translate-y-distance)));
left: 0;
- display: flex;
- /* Using column-reverse flex direction enables a stack-like
- behavior where the most recent alert is always on top. */
- flex-direction: column-reverse;
- align-items: center;
- justify-content: center;
- gap: 5px;
width: 100%;
z-index: 220;
max-height: 100%;