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: Use consistent width for input and dropdown elements.

evykassirerc872bea5e8c4
diff --git a/web/styles/app_variables.css b/web/styles/app_variables.css
index eb49541603e..6cbb50e7f6d 100644
--- a/web/styles/app_variables.css
+++ b/web/styles/app_variables.css
@@ -539,6 +539,7 @@
--subscriptions-overlay-sticky-footer-height: 60px;
/* Informational overlay */
--informational-overlay-max-width: 43.75em;
+ --modal-input-width: 23.2142em;
/*
Maximum height of the compose box when it is not in maximised state. This
diff --git a/web/styles/modal.css b/web/styles/modal.css
index 63cc9f2e1ca..5c40d9454e1 100644
--- a/web/styles/modal.css
+++ b/web/styles/modal.css
@@ -403,7 +403,7 @@
.modal_select {
height: 30px;
- width: 220px;
+ width: var(--modal-input-width);
padding: 0 25px 0 6px;
color: hsl(0deg 0% 33%);
border-radius: 4px;
@@ -429,6 +429,14 @@
width: fit-content;
}
+.modal__body,
+.overlay-content {
+ .dropdown-widget-button,
+ .dropdown_widget_with_label_wrapper {
+ width: var(--modal-input-width);
+ }
+}
+
.modal_password_input,
.modal_url_input,
.modal_text_input {
@@ -441,7 +449,8 @@
border-color linear 0.2s,
box-shadow linear 0.2s;
margin-bottom: 10px;
- width: 206px;
+ /* subtract padding (6px each side) and border (1px each side) */
+ width: calc(var(--modal-input-width) - 14px);
&:focus {
border-color: hsl(206deg 80% 62% / 80%);
@@ -452,6 +461,12 @@
}
}
+#create_bot_short_name {
+ /* A shorter dropdown width (~200px at 14px em)
+ to ensure the email all fits on one line. */
+ width: 14em;
+}
+
#add-poll-modal {
/* this height allows 3-4 option rows
to fit in without need for scrolling */
diff --git a/web/styles/settings.css b/web/styles/settings.css
index 40acb840ed4..df59e761f46 100644
--- a/web/styles/settings.css
+++ b/web/styles/settings.css
@@ -283,7 +283,7 @@ h3,
.settings_select {
height: 30px;
- min-width: 325px;
+ width: var(--modal-input-width);
max-width: 100%;
}
@@ -292,6 +292,13 @@ h3,
}
}
+/* Make this one less wide because it's indented, so that the right
+ edge lines up with other dropdown menus. Usual 33px plus 23px extra
+ margin. */
+#id_realm_jitsi_server_url {
+ width: calc(var(--modal-input-width) - 33px - 23px);
+}
+
/* list_select is similar to settings_select, but without the height styling. */
.settings_select,
.list_select {
@@ -360,20 +367,19 @@ select.settings_select {
/* Preserve the effective space allotted
inside the input group.
- Select element: 325px
+ Select element: --modal-input-width
Button element: ~29px
- Right margin: 4px
- TOTAL 358px */
- max-width: 358px;
+ Right margin: 4px */
+ max-width: calc(var(--modal-input-width) + 29px + 4px);
.settings_select {
- /* Hold the settings select to its usual 325px;
+ /* Hold the settings select to its usual value;
a TODO would be to fix up the min- and max-
width values on the parent class, as the
min-width always applies, and max-width: 100%
has no meaning without an actual width:
declaration. */
- max-width: 325px;
+ max-width: var(--modal-input-width);
/* Disregard the min-width from the main
.settings_select selector. */
min-width: 0;
@@ -673,11 +679,13 @@ input[type="checkbox"] {
}
.person_picker {
- min-width: 319px;
+ /* Subtract 2 * (2px padding) + 2 * (1px border) */
+ min-width: calc(var(--modal-input-width) - 6px);
}
& textarea {
- width: 311px;
+ /* Subtract 6px of padding from side */
+ width: calc(var(--modal-input-width) - 12px);
}
}
@@ -699,7 +707,7 @@ input[type="checkbox"] {
grid-template-areas: "datepicker close-button";
grid-template-columns: minmax(0, 1fr) 1.4285em; /* 20px at 14px em */
align-items: center;
- width: 325px;
+ width: var(--modal-input-width);
}
.control-label-disabled {
@@ -816,8 +824,6 @@ input[type="checkbox"] {
#organization-permissions {
.dropdown-widget-button {
- min-width: 325px;
- width: auto;
color: hsl(0deg 0% 33%);
}
}
@@ -829,9 +835,8 @@ input[type="checkbox"] {
}
.org-permissions-form .pill-container {
- /* 319px + 2 * (2px padding) + 2 * (1px border) = 325px, which is the total
- width of dropdown widget buttons */
- min-width: 319px;
+ /* Subtract 2 * (2px padding) + 2 * (1px border) */
+ min-width: calc(var(--modal-input-width) - 6px);
background-color: hsl(0deg 0% 100%);
.input {
@@ -1506,7 +1511,7 @@ label.preferences-radio-choice-label {
}
.preferences-settings-form select {
- width: 245px;
+ width: var(--modal-input-width);
}
}
@@ -1566,8 +1571,9 @@ label.preferences-radio-choice-label {
cursor: default;
padding-right: 1.4285em; /* 20px at 14px em */
/* full input width minus right padding and
- 6px left padding from .settings_text_input */
- max-width: calc(325px - 1.4285em - 6px);
+ 6px left padding from .settings_text_input
+ and 1px border on each side */
+ max-width: calc(var(--modal-input-width) - 1.4285em - 8px);
}
& input[disabled].datepicker {
@@ -1589,12 +1595,13 @@ label.preferences-radio-choice-label {
#edit-user-form {
.person_picker {
- min-width: 206px;
+ /* Subtract (1px border and 2px of padding) on each side */
+ min-width: calc(var(--modal-input-width) - 6px);
}
& textarea {
- width: max(206px, 25vw);
- max-width: 320px;
+ /* Subtract (1px border and 6px padding) on each side */
+ width: calc(var(--modal-input-width) - 14px);
}
}
@@ -2140,9 +2147,8 @@ label.preferences-radio-choice-label {
box-shadow linear 0.2s;
margin-bottom: 10px;
- /* 311px + 2 * 6px (padding) + 2 * 1px (border) = 325px (min width of select
- elements in settings) */
- width: 311px;
+ /* Subtract 2 * 6px (padding) + 2 * 1px (border) */
+ width: calc(var(--modal-input-width) - 14px);
&:focus {
border-color: hsl(206deg 80% 62% / 80%);
diff --git a/web/styles/subscriptions.css b/web/styles/subscriptions.css
index a2e91c44602..90216c814a8 100644
--- a/web/styles/subscriptions.css
+++ b/web/styles/subscriptions.css
@@ -1266,7 +1266,7 @@ div.settings-radio-input-parent {
.settings_select {
/* Match with select elements in settings page */
- min-width: 325px;
+ min-width: var(--modal-input-width);
max-width: 100%;
height: 30px;
}
@@ -1274,7 +1274,7 @@ div.settings-radio-input-parent {
.dropdown-widget-button {
/* Match the margin with other input groups around. */
margin-bottom: 20px;
- min-width: 325px;
+ min-width: var(--modal-input-width);
max-width: 100%;
width: auto;
height: 30px;
@@ -1292,9 +1292,8 @@ div.settings-radio-input-parent {
.group-permissions .pill-container,
.stream-permissions .pill-container {
- /* 319px + 2 * (2px padding) + 2 * (1px border) = 325px, which is the total
- width of dropdown widget buttons */
- min-width: 319px;
+ /* Subtract 2 * (2px padding) + 2 * (1px border) */
+ min-width: calc(var(--modal-input-width) - 6px);
background-color: hsl(0deg 0% 100%);
.input {