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.

css: Use "--column-count" custom property to handle narrow screen UI.

Sahil Batra0295d715621a
diff --git a/web/src/overlays.ts b/web/src/overlays.ts
index 3e11cd196c2..c693e80320c 100644
--- a/web/src/overlays.ts
+++ b/web/src/overlays.ts
@@ -211,7 +211,8 @@ export function trap_focus_for_settings_overlay(): void {
return;
}
- const two_column_mode = $("#settings_content").css("--single-column") === undefined;
+ const two_column_mode =
+ Number.parseInt($("#settings_content").css("--column-count"), 10) === 2;
const $settings_overlay_container = $("#settings_overlay_container");
let visible_focusable_elements;
if (two_column_mode) {
@@ -258,7 +259,10 @@ export function trap_focus_for_settings_overlay(): void {
const $overlay = $(e.currentTarget);
const two_column_mode =
- $overlay.find(".two-pane-settings-container").css("--single-column") === undefined;
+ Number.parseInt(
+ $overlay.find(".two-pane-settings-container").css("--column-count"),
+ 10,
+ ) === 2;
let visible_focusable_elements;
if (two_column_mode) {
visible_focusable_elements =
diff --git a/web/src/settings_panel_menu.ts b/web/src/settings_panel_menu.ts
index 11599682db2..b3b5464d6d7 100644
--- a/web/src/settings_panel_menu.ts
+++ b/web/src/settings_panel_menu.ts
@@ -31,7 +31,7 @@ export function mobile_activate_section(): void {
}
function two_column_mode(): boolean {
- return $("#settings_content").css("--single-column") === undefined;
+ return Number.parseInt($("#settings_content").css("--column-count"), 10) === 2;
}
function set_settings_header(key: string): void {
diff --git a/web/styles/settings.css b/web/styles/settings.css
index b1fc4f311fa..f45c4bc8b7f 100644
--- a/web/styles/settings.css
+++ b/web/styles/settings.css
@@ -193,6 +193,10 @@ h3,
& table + .progressive-table-wrapper table tr.user_row td:first-of-type {
width: 20%;
}
+
+ /* This variable allows JavaScript to detect whether we are showing both
+ the left sidebar and settings content for the current screen width or not. */
+ --column-count: 2;
}
#uploaded_files_table > tr > td:nth-of-type(1),
@@ -1862,8 +1866,9 @@ label.preferences-radio-choice-label {
}
#settings_content {
- /* this variable allows JavaScript to detect this media query */
- --single-column: yes;
+ /* This variable allows JavaScript to detect whether we are showing both
+ the left sidebar and settings content for the current screen width or not. */
+ --column-count: 1;
}
#settings_page {
diff --git a/web/styles/subscriptions.css b/web/styles/subscriptions.css
index 90854369999..85a9a44d9e3 100644
--- a/web/styles/subscriptions.css
+++ b/web/styles/subscriptions.css
@@ -511,6 +511,10 @@ h4.user_group_setting_subsection_title {
max-width: 1200px;
max-height: var(--overlay-container-max-height);
+ /* This variable allows JavaScript to detect whether we are showing both
+ the left sidebar and settings content for the current screen width or not. */
+ --column-count: 2;
+
.list-toggler-container .tab-switcher .ind-tab {
width: auto;
display: flex;
@@ -1474,7 +1478,9 @@ div.settings-radio-input-parent {
position: relative;
overflow: hidden;
- --single-column: yes;
+ /* This variable allows JavaScript to detect whether we are showing both
+ the left sidebar and settings content for the current screen width or not. */
+ --column-count: 1;
.two-pane-settings-header .fa-chevron-left {
visibility: visible;