Files
wekan/client/components/settings/settingBody.css
T
Lauri Ojansivu d03cd03007 Stop elements resizing with the browser window, this time inside clamp().
Reported on a board in mobile mode in desktop Firefox: widening the window made the
swimlanes, lists and cards taller; narrowing it shrank them again. The same complaint
as /sign-in and /sign-up, and the same cause - a size measured against the WINDOW
instead of being a size.

The earlier sweep converted 355 bare `vh`/`vw` values but explicitly ALLOWED
`min()`, `max()` and `clamp()`, on the grounds that they are caps. `clamp()` is not.
It is only a cap at its two ends; between them it tracks the viewport exactly like a
bare `vw`. So `font-size: clamp(18px, 2.5vw, 32px)` on a swimlane header, a list
header and a minicard is a font that grows with the window - and since those rows are
sized by their text, the rows grow with it. There were 75 of these across 17
stylesheets, 36 of them in the mobile-mode board rules.

All 75 are converted to the size they already rendered at on a phone - the lower bound
of each clamp. That is the value these rules were designed around (below ~800px the
clamp was pinned to it anyway), it is in line with the rest of the UI's fixed sizes,
and picking the upper bound instead would have made every phone bigger than it is
today.

Also converted, same behaviour by other spellings:

  * `.board-sidebar { width: clamp(320px, 30vw, 560px) }` -> a fixed 420px. Its own
    comment recorded 420px as the intended width; the clamp was added to stop a bare
    30vw doubling on wide screens, but it still resized in between.
  * `min-height: 3vh` on the mobile minicard -> 24px.
  * `min-height: 60vh` on a collapsed list -> 540px, which is exactly what the
    `height: 540px` on the very next line already says.
  * `min-height: 60vh` (settings body) -> 540px; `min-height: 14vh` (search popover)
    -> 126px.
  * `max-width: 13vw` on a minicard custom-field chip -> 160px.

tests/noViewportSpacing.test.cjs no longer allows clamp() or a viewport `min-*`, and
says why. What stays allowed is a full-viewport box (100vh/100vw), a `max-height` /
`max-width` cap, and `min(400px, 52vw)` - a shrink-only cap, flat at the px above the
crossover width and giving way only below it so a box fits a narrow screen. It never
grows with the window, so it is not this bug; `max(...)`, which does grow without
bound, is not allowed. Both argument orders are accepted.

tests/sidebarWidth.test.cjs required `clamp()` for the sidebar - that was the fix for
the doubling, and it is now the thing being removed. It asks for a fixed px width and
no viewport unit at all, which is a stronger form of what it was guarding.

Tests: 1321 passing.

Thanks to xet7 !
2026-07-25 22:08:38 +03:00

383 lines
12 KiB
CSS

.flex,
.setting-content .content-body .side-menu ul li a,
.option {
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
height: 100%;
}
.setting-content {
color: #727479;
background: #dedede;
width: 100%;
height: 100%;
position: absolute;
}
.setting-content .content-title {
font-size: 16px;
}
.setting-content .content-body {
display: flex;
/* Always keep the menu (left) and content (right) side by side, even on
narrow windows. The side menu has a fixed basis and the main body fills
the rest, so both stay visible without switching to a stacked layout. */
flex-direction: row;
flex-wrap: nowrap;
padding-top: 18px;
height: 100%;
gap: 18px;
}
.setting-content .content-body .side-menu {
background-color: #f7f7f7;
border: 1px solid #f0f0f0;
border-radius: 7px;
width: min(250px, 32vw);
/* Never let the menu be squeezed away on narrow windows; keep it visible. */
flex: 0 0 auto;
/* No X offset: an inset shadow offset sideways is a PHYSICAL direction and does
not mirror under dir=rtl, so it shaded the wrong inner edge once the menu moved
to the right. See docs/Design/Page/Left-Menu.md. */
box-shadow: inset 0 -2px 4px rgba(0,0,0,0.05);
}
.setting-content .content-body .side-menu ul li {
margin: 2px 4px;
}
.setting-content .content-body .side-menu ul li.active {
background: #fff;
box-shadow: 0 2px 3px rgba(0,0,0,0.15);
}
/* The one themeable part of the menu: the entry you are on takes the per-user
theme accent (Member Settings -> Change color sets --theme-accent on :root).
The fallback is "inherit", so with no custom colour the menu looks exactly as
it always has - the WeKan default. See docs/Design/Page/Left-Menu.md. */
.setting-content .content-body .side-menu ul li.active > a {
color: var(--theme-accent, inherit);
}
.setting-content .content-body .side-menu ul li:hover {
background: #fff;
box-shadow: 0 2px 3px rgba(0,0,0,0.15);
}
.setting-content .content-body .side-menu ul li a {
/* Logical, so the indent follows the reading direction instead of staying on
the left when the menu mirrors to the right. */
padding-block: 12px;
padding-inline-start: 18px;
padding-inline-end: 0;
width: 95%;
}
.setting-content .content-body .side-menu ul li a span {
font-size: 13px;
}
.setting-content .content-body .side-menu ul li a i {
margin-inline-end: 20px;
}
.setting-content .content-body .main-body {
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
max-height: 100%;
overflow-x: scroll !important;
overflow-y: scroll !important;
scrollbar-gutter: stable;
/* Grow into the space left next to the side menu. flex-basis MUST be 0 here:
this element holds a min-width:1200px table and a 100vw ::after, so a
content-based (auto) basis is huge and, as an overflow:scroll flex item,
resolves unpredictably (collapsing the panel). Basis 0 + grow makes the
width = container - side menu, deterministically. min-width:0 lets it
shrink so the side menu is never pushed out on narrow windows. */
flex: 1 1 0;
min-width: 0;
}
/* Ensure scrollbars are always visible with proper styling for all admin pages */
.setting-content .content-body .main-body::-webkit-scrollbar {
width: 12px;
height: 12px;
display: block !important;
visibility: visible !important;
}
.setting-content .content-body .main-body::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 6px;
display: block !important;
visibility: visible !important;
}
.setting-content .content-body .main-body::-webkit-scrollbar-thumb {
background: #888;
border-radius: 6px;
display: block !important;
visibility: visible !important;
}
.setting-content .content-body .main-body::-webkit-scrollbar-thumb:hover {
background: #555;
}
.setting-content .content-body .main-body::-webkit-scrollbar-corner {
background: #f1f1f1;
}
/* Ensure tables and content are wide enough to trigger horizontal scrolling */
.setting-content .content-body .main-body table {
min-width: 1200px !important;
width: max-content !important;
table-layout: auto !important;
}
/* Force tables to always trigger horizontal scrolling */
.setting-content .content-body .main-body table td {
white-space: nowrap;
min-width: 120px;
}
/* #6465: headers may wrap — nowrap on long header labels (e.g. the org/team
feature columns) blew the column widths up to the whole label length. */
.setting-content .content-body .main-body table th {
white-space: normal;
min-width: 120px;
max-width: 240px;
}
/* Ensure there's enough content to trigger vertical scrolling */
.setting-content .content-body .main-body {
min-height: calc(100vh - 200px);
padding-bottom: 50px;
}
/* Admin panel buttons should use theme darker color */
.setting-content .content-body .main-body .setting-detail button.btn {
background: var(--theme-accent, #005377);
color: #fff;
border: none;
}
.setting-content .content-body .main-body .setting-detail button.btn:hover,
.setting-content .content-body .main-body .setting-detail button.btn:focus {
background: var(--theme-accent, #004766);
color: #fff;
}
.setting-content .content-body .main-body .setting-detail button.btn:active {
background: var(--theme-accent, #01628c);
color: #fff;
}
/* Force horizontal scrollbar to always be visible at bottom */
.setting-content .content-body .main-body {
position: relative;
}
/* Add invisible content to force horizontal scrolling when needed */
.setting-content .content-body .main-body::after {
content: '';
display: block;
width: 100vw;
height: 1px;
position: absolute;
bottom: 0;
inset-inline-start: 0;
pointer-events: none;
}
.setting-content .content-body .main-body ul li {
padding: 0.5rem 0.5rem;
}
.setting-content .content-body .main-body ul li a .is-checked {
border-bottom: 2px solid #3cb500;
border-inline-end: 2px solid #3cb500;
}
/* Grey checkmarks when grey icons setting is enabled */
body.grey-icons-enabled .setting-content .content-body .main-body ul li a .is-checked {
border-bottom: 2px solid #7a7a7a;
border-inline-end: 2px solid #7a7a7a;
}
.setting-content .content-body .main-body ul li a span {
padding: 0 0.5rem;
}
.setting-content .content-body .main-body ul li .admin-announcement,
.setting-content .content-body .main-body ul li .admin-accessibility,
.setting-content .content-body .main-body ul li .invite-people,
.setting-content .content-body .main-body ul li .layout {
padding-inline-start: 20px;
}
.setting-content .content-body .main-body ul li .admin-announcement li,
.setting-content .content-body .main-body ul li .admin-accessibility li,
.setting-content .content-body .main-body ul li .invite-people li,
.setting-content .content-body .main-body ul li .layout li {
min-width: 500px;
}
.setting-content .content-body .main-body ul li .admin-announcement li ul.no-margin-bottom,
.setting-content .content-body .main-body ul li .admin-accessibility li ul.no-margin-bottom,
.setting-content .content-body .main-body ul li .invite-people li ul.no-margin-bottom,
.setting-content .content-body .main-body ul li .layout li ul.no-margin-bottom {
margin-bottom: 0;
}
.setting-content .content-body .main-body ul li .admin-announcement li .bg-white a,
.setting-content .content-body .main-body ul li .admin-accessibility li .bg-white a,
.setting-content .content-body .main-body ul li .invite-people li .bg-white a,
.setting-content .content-body .main-body ul li .layout li .bg-white a {
background: #f7f7f7;
}
.setting-content .content-body .main-body ul li .admin-announcement li .bg-white a.is-checked,
.setting-content .content-body .main-body ul li .admin-accessibility li .bg-white a.is-checked,
.setting-content .content-body .main-body ul li .invite-people li .bg-white a.is-checked,
.setting-content .content-body .main-body ul li .layout li .bg-white a.is-checked {
background: #fff;
}
.setting-content .content-body .main-body ul li input[type=radio] {
margin: 4px;
}
.option {
-webkit-border-radius: 3px;
border-radius: 3px;
background: #fff;
text-decoration: none;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.2);
box-shadow: 0 1px 2px rgba(0,0,0,0.2);
margin-top: 5px;
padding: 5px;
}
.title {
font-weight: 700;
margin-bottom: 0.5rem;
}
.description {
margin-bottom: 0.5rem;
}
.bg-white {
background: #f9fbfc;
}
.wekan-form-control.has-error {
border-color: #a94442;
box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
}
li.has-error {
color: #a94442;
}
li.has-error .form-group .wekan-form-control {
border-color: #a94442;
box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
}
/* Constrain textarea elements with balanced left/right spacing */
.setting-content .content-body .main-body textarea.wekan-form-control {
width: calc(100% - 20px);
margin: 0 10px;
max-width: calc(100vw - 320px);
box-sizing: border-box;
}
/* For nested custom head/manifest/assetlinks sections */
.setting-content .content-body .main-body .custom-head-settings textarea.wekan-form-control,
.setting-content .content-body .main-body .custom-manifest-settings textarea.wekan-form-control,
.setting-content .content-body .main-body .custom-assetlinks-settings textarea.wekan-form-control {
width: calc(100% - 20px);
margin-inline-start: 0;
margin-inline-end: 10px;
max-width: calc(100vw - 240px);
box-sizing: border-box;
}
.setting-content .content-body .main-body .attachment-limit-row {
display: flex;
align-items: center;
gap: 10px;
max-width: 560px;
}
.setting-content .content-body .main-body .attachment-limit-row input.wekan-form-control {
flex: 1;
min-width: 200px;
}
.setting-content .content-body .main-body .attachment-limit-row select.wekan-form-control {
width: 120px;
min-width: 120px;
}
/* #6419: on phones the admin settings forced a side-by-side menu+content layout
(flex-direction: row "even on narrow windows"), so the ~127px side menu and the
content were crammed together and the long (e.g. Finnish) menu labels overflowed
the menu box rightward, visually overlapping the content. Stack them on small
screens: a full-width compact menu on top, full-width content below. */
@media screen and (max-width: 800px) {
.setting-content {
position: relative;
height: auto;
min-height: 100%;
}
.setting-content .content-body {
flex-direction: column;
flex-wrap: nowrap;
gap: 8px;
height: auto;
padding-top: 9px;
}
.setting-content .content-body .side-menu {
width: 100%;
flex: 0 0 auto;
border-radius: 6px;
}
/* Menu items as a wrapping horizontal row so the menu stays compact on top. */
.setting-content .content-body .side-menu ul {
display: flex;
flex-wrap: wrap;
gap: 4px;
padding: 4px;
}
.setting-content .content-body .side-menu ul li {
flex: 0 0 auto;
margin: 0;
}
.setting-content .content-body .side-menu ul li a {
width: auto;
white-space: nowrap;
padding: 10px 12px;
}
.setting-content .content-body .main-body {
width: 100%;
flex: 1 1 auto;
min-height: 540px;
overflow-x: auto !important;
}
}
/* ── Admin tables on a phone: fit the width, wrap the text ───────────────────
The rules above deliberately force EVERY admin table to `min-width: 1200px`
with `white-space: nowrap` cells, to guarantee a horizontal scrollbar for the
wide data tables. On a 375px phone that also applies to a two-column table
like Admin Panel / Version, where "WeKan Version" and its value sit ~1000px
apart and you have to scroll right to read a value you already have room for.
At small width the table is instead allowed to be as wide as the screen and no
wider, and cells may use as many lines as they need. Long unbroken values -
version strings, paths, URLs - break rather than push the table wide again.
Horizontal scrolling still works if a genuinely wide table cannot fit; it is
just no longer forced on tables that would fit comfortably. */
@media screen and (max-width: 800px) {
.setting-content .content-body .main-body table {
min-width: 0 !important;
width: 100% !important;
table-layout: auto !important;
}
.setting-content .content-body .main-body table td,
.setting-content .content-body .main-body table th {
white-space: normal !important;
min-width: 0 !important;
max-width: none !important;
overflow-wrap: break-word;
word-break: break-word;
}
/* The label column keeps a sensible share rather than collapsing to one
character per line when a value is long. */
.setting-content .content-body .main-body table th {
width: 45%;
}
}