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.

modals: Make redesigned modals work with portico and billing pages.

Sayam Samal847a7f8f9c07
diff --git a/templates/corporate/billing/billing.html b/templates/corporate/billing/billing.html
index e18492bf107..278def1ee4e 100644
--- a/templates/corporate/billing/billing.html
+++ b/templates/corporate/billing/billing.html
@@ -418,7 +418,9 @@
{% endif %}
</h1>
</div>
- <button class="modal__close" aria-label="{{ _('Close modal') }}" data-micromodal-close></button>
+ <button type="button" class="modal__close" aria-label="{{ _('Close modal') }}" tabindex="0" data-micromodal-close>
+ <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>
+ </button>
</header>
<main class="modal__content">
<p>
@@ -455,7 +457,9 @@
Confirm adding licenses
</h1>
</div>
- <button class="modal__close" aria-label="{{ _('Close modal') }}" data-micromodal-close></button>
+ <button type="button" class="modal__close" aria-label="{{ _('Close modal') }}" tabindex="0" data-micromodal-close>
+ <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>
+ </button>
</header>
<main class="modal__content">
<p>
@@ -490,7 +494,9 @@
Confirm decreasing licenses
</h1>
</div>
- <button class="modal__close" aria-label="{{ _('Close modal') }}" data-micromodal-close></button>
+ <button type="button" class="modal__close" aria-label="{{ _('Close modal') }}" tabindex="0" data-micromodal-close>
+ <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>
+ </button>
</header>
<main class="modal__content">
<p>
@@ -521,7 +527,9 @@
Downgrade {{ org_name }} to Zulip Cloud Free?
</h1>
</div>
- <button class="modal__close" aria-label="{{ _('Close modal') }}" data-micromodal-close></button>
+ <button type="button" class="modal__close" aria-label="{{ _('Close modal') }}" tabindex="0" data-micromodal-close>
+ <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>
+ </button>
</header>
<main class="modal__content">
<p>
@@ -549,7 +557,9 @@
Downgrade {{ org_name }} to the Free plan?
</h1>
</div>
- <button class="modal__close" aria-label="{{ _('Close modal') }}" data-micromodal-close></button>
+ <button type="button" class="modal__close" aria-label="{{ _('Close modal') }}" tabindex="0" data-micromodal-close>
+ <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>
+ </button>
</header>
<main class="modal__content">
<p>
@@ -579,7 +589,9 @@
Cancel scheduled upgrade of {{ org_name }}?
</h1>
</div>
- <button class="modal__close" aria-label="{{ _('Close modal') }}" data-micromodal-close></button>
+ <button type="button" class="modal__close" aria-label="{{ _('Close modal') }}" tabindex="0" data-micromodal-close>
+ <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>
+ </button>
</header>
<main class="modal__content">
<p>
@@ -614,22 +626,22 @@
{% endif %}
license management
</h1>
+ <div class="modal__subtitle">
+ Are you sure you want to switch to
+ <a href="/help/self-hosted-billing#how-does-automatic-license-management-work">
+ {% if automanage_licenses %}
+ manual
+ {% else %}
+ automatic
+ {% endif %}
+ license management
+ </a>?
+ </div>
</div>
- <button class="modal__close" aria-label="{{ _('Close modal') }}" data-micromodal-close></button>
+ <button type="button" class="modal__close" aria-label="{{ _('Close modal') }}" tabindex="0" data-micromodal-close>
+ <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>
+ </button>
</header>
- <main class="modal__content">
- <p>
- Are you sure you want to switch to
- <a href="/help/self-hosted-billing#how-does-automatic-license-management-work">
- {% if automanage_licenses %}
- manual
- {% else %}
- automatic
- {% endif %}
- license management
- </a>?
- </p>
- </main>
<footer class="modal__footer">
<button class="modal__button dialog_exit_button" aria-label="{{ '(Close this dialog window)' }}" data-micromodal-close>{{ _('Never mind') }}</button>
<button class="modal__button dialog_submit_button">
diff --git a/templates/corporate/billing/upgrade.html b/templates/corporate/billing/upgrade.html
index 42772834b31..f4fbb44e30c 100644
--- a/templates/corporate/billing/upgrade.html
+++ b/templates/corporate/billing/upgrade.html
@@ -327,7 +327,9 @@
{% endif %}
</h1>
</div>
- <button class="modal__close" aria-label="{{ _('Close modal') }}" data-micromodal-close></button>
+ <button type="button" class="modal__close" aria-label="{{ _('Close modal') }}" tabindex="0" data-micromodal-close>
+ <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>
+ </button>
</header>
<main class="modal__content">
<p>
diff --git a/templates/zerver/create_user/change_email_address_visibility_modal.html b/templates/zerver/create_user/change_email_address_visibility_modal.html
index ad2f28b2290..8eb0287823a 100644
--- a/templates/zerver/create_user/change_email_address_visibility_modal.html
+++ b/templates/zerver/create_user/change_email_address_visibility_modal.html
@@ -7,7 +7,9 @@
{{ _('Configure email address privacy') }}
</h1>
</div>
- <button class="modal__close" aria-label="{{ _('Close modal') }}" data-micromodal-close></button>
+ <button type="button" class="modal__close" aria-label="{{ _('Close modal') }}" tabindex="0" data-micromodal-close>
+ <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>
+ </button>
</header>
<main class="modal__content">
<p>
diff --git a/templates/zerver/development/email_log.html b/templates/zerver/development/email_log.html
index 74a52208c0d..c3fc69801bc 100644
--- a/templates/zerver/development/email_log.html
+++ b/templates/zerver/development/email_log.html
@@ -32,7 +32,9 @@
{{ _('Forward emails to an email account') }}
</h1>
</div>
- <button class="modal__close" aria-label="{{ _('Close modal') }}" data-micromodal-close></button>
+ <button type="button" class="modal__close" aria-label="{{ _('Close modal') }}" tabindex="0" data-micromodal-close>
+ <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>
+ </button>
</header>
<main class="modal__content">
<div class="input-group">
diff --git a/web/styles/app_variables.css b/web/styles/app_variables.css
index bcc1d1ba6c6..7534fc33090 100644
--- a/web/styles/app_variables.css
+++ b/web/styles/app_variables.css
@@ -853,33 +853,6 @@
hsl(0deg 0% 100% / 90%),
hsl(212deg 28% 8% / 75%)
);
- --color-background-modal-overlay: color-mix(
- in oklch,
- hsl(0deg 0% 0%) 25%,
- transparent
- );
- --color-modal-heading-text: light-dark(
- hsl(0deg 0% 15%),
- color-mix(in oklch, hsl(0deg 0% 100%) 85%, transparent)
- );
- --color-modal-subtitle-text: color-mix(
- in oklch,
- var(--color-modal-heading-text) 75%,
- transparent
- );
- --color-background-modal: light-dark(hsl(0deg 0% 93%), hsl(0deg 0% 14%));
- --color-background-modal-bar: light-dark(
- hsl(0deg 0% 96%),
- hsl(0deg 0% 20%)
- );
- --color-border-modal: light-dark(
- hsl(0deg 0% 55%),
- color-mix(in oklch, hsl(0deg 0% 100%) 15%, transparent)
- );
- --color-border-modal-bar: light-dark(
- hsl(0deg 0% 76%),
- color-mix(in oklch, hsl(0deg 0% 100%) 12%, transparent)
- );
--color-modal-selectable-icon: light-dark(
hsl(240deg 30% 40%),
hsl(240deg 35% 68%)
diff --git a/web/styles/modal.css b/web/styles/modal.css
index 7d9daf08657..5e797a30ac2 100644
--- a/web/styles/modal.css
+++ b/web/styles/modal.css
@@ -6,6 +6,37 @@
--color-exit-button-border: hsl(300deg 2% 11% / 30%);
--color-exit-button-background: hsl(226deg 1% 42% / 20%);
--color-exit-button-background-interactive: hsl(226deg 1% 42% / 27%);
+
+ /* Since modals are also present in portico and billing pages, we define
+ the modal related variables directly here in the modal.css — which is
+ a part of the common.ts bundle shared between portico and main app. */
+ --color-background-modal-overlay: color-mix(
+ in oklch,
+ hsl(0deg 0% 0%) 25%,
+ transparent
+ );
+ --color-modal-heading-text: light-dark(
+ hsl(0deg 0% 15%),
+ color-mix(in oklch, hsl(0deg 0% 100%) 85%, transparent)
+ );
+ --color-modal-subtitle-text: color-mix(
+ in oklch,
+ var(--color-modal-heading-text) 75%,
+ transparent
+ );
+ --color-background-modal: light-dark(hsl(0deg 0% 93%), hsl(0deg 0% 14%));
+ --color-background-modal-bar: light-dark(
+ hsl(0deg 0% 96%),
+ hsl(0deg 0% 20%)
+ );
+ --color-border-modal: light-dark(
+ hsl(0deg 0% 55%),
+ color-mix(in oklch, hsl(0deg 0% 100%) 15%, transparent)
+ );
+ --color-border-modal-bar: light-dark(
+ hsl(0deg 0% 76%),
+ color-mix(in oklch, hsl(0deg 0% 100%) 12%, transparent)
+ );
}
.modal__overlay {
diff --git a/web/styles/portico/billing.css b/web/styles/portico/billing.css
index 58b20439e77..d25f9fc0858 100644
--- a/web/styles/portico/billing.css
+++ b/web/styles/portico/billing.css
@@ -1,7 +1,3 @@
-:root {
- --color-background-modal: hsl(0deg 0% 98%);
-}
-
.billing-upgrade-page {
font-family: "Source Sans 3 VF", sans-serif;
background-color: hsl(0deg 0% 98%);
diff --git a/web/styles/portico/email_log.css b/web/styles/portico/email_log.css
index 90380545be0..dc1ee153337 100644
--- a/web/styles/portico/email_log.css
+++ b/web/styles/portico/email_log.css
@@ -1,7 +1,3 @@
-:root {
- --color-background-modal: hsl(0deg 0% 98%);
-}
-
#dev-email-log-container {
.dev-email-log-header {
position: fixed;
@@ -77,7 +73,6 @@
.modal__content label {
font-size: 1rem;
display: block;
- margin-bottom: 5px;
cursor: pointer;
}
@@ -94,7 +89,7 @@
float: left;
width: auto;
cursor: pointer;
- margin: 4px 0 0 -20px;
+ margin: -4px 0 0 -20px;
line-height: normal;
&:focus {
diff --git a/web/styles/portico/legacy_portico.css b/web/styles/portico/legacy_portico.css
index b1896c69450..cfd92315a83 100644
--- a/web/styles/portico/legacy_portico.css
+++ b/web/styles/portico/legacy_portico.css
@@ -1,5 +1,4 @@
:root {
- --color-background-modal: hsl(0deg 0% 98%);
/*
It is fine if footer is longer than that
since we are only trying to avoid overlap.
diff --git a/web/styles/portico/legacy_portico_styles_bundle.css b/web/styles/portico/legacy_portico_styles_bundle.css
index 31d1298b98f..5d13a9e5df0 100644
--- a/web/styles/portico/legacy_portico_styles_bundle.css
+++ b/web/styles/portico/legacy_portico_styles_bundle.css
@@ -1,5 +1,6 @@
@import url("../components.css");
@import url("legacy_portico.css");
+@import url("portico_modals.css");
@import url("portico_signin.css");
@import url("markdown.css");
@import url("navbar.css");
diff --git a/web/styles/portico/portico_modals.css b/web/styles/portico/portico_modals.css
new file mode 100644
index 00000000000..a1f4d330867
--- /dev/null
+++ b/web/styles/portico/portico_modals.css
@@ -0,0 +1,50 @@
+/* This file contains the required variables and styles for the modals
+ to work properly in the portico, billing, upgrade and dev email log pages. */
+
+:root {
+ /* This is a copy of the neutral icon button variables defined
+ in app_variables.css required for the modal close button styling. */
+ --color-text-neutral-icon-button: light-dark(
+ color-mix(in oklch, hsl(229deg 9% 36%) 70%, transparent),
+ color-mix(in oklch, hsl(229deg 10% 70%) 70%, transparent)
+ );
+ --color-text-neutral-icon-button-hover: light-dark(
+ hsl(229deg 9% 36%),
+ hsl(229deg 10% 70%)
+ );
+ --color-text-neutral-icon-button-active: light-dark(
+ color-mix(in oklch, hsl(229deg 9% 36%) 70%, transparent),
+ color-mix(in oklch, hsl(229deg 10% 70%) 70%, transparent)
+ );
+}
+
+.modal__container {
+ --base-font-size-px: 16px;
+ font-size: var(--base-font-size-px);
+ font-weight: 400;
+}
+
+.modal__close {
+ /* This is a subset of the styling defined for the icon button
+ component in web/styles/buttons.css. */
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ aspect-ratio: 1;
+ font-size: var(--base-font-size-px);
+ background-color: transparent; /* Override button default background color */
+ cursor: pointer;
+ border: none;
+ border-radius: 4px;
+
+ color: var(--color-text-neutral-icon-button);
+
+ &:hover,
+ &:focus-visible {
+ color: var(--color-text-neutral-icon-button-hover);
+ }
+
+ &:active {
+ color: var(--color-text-neutral-icon-button-active);
+ }
+}
diff --git a/web/webpack.dev-assets.json b/web/webpack.dev-assets.json
index fd1b828c4d0..80e1a09092d 100644
--- a/web/webpack.dev-assets.json
+++ b/web/webpack.dev-assets.json
@@ -11,6 +11,7 @@
"./src/bundles/common.ts",
"./src/portico/email_log.ts",
"./src/portico/portico_modals.ts",
+ "./styles/portico/legacy_portico_styles_bundle.css",
"./styles/portico/email_log.css",
"./src/reload_state.ts",
"./src/channel.ts"