menus and panels stay inside the glass: a card's context menu clamps to the viewport the way dropdown's place() already did, and the move submenu flips or pins itself inside too — its spot computed in the script because only JS knows the cursor and the pane; wide pickers take a floor that yields to the screen, the datepick anchors right so it opens inside the panel, tables and long runs fold or pan instead of overflowing; and a tablet band between the phone fold and the desktop keeps the desktop layout but gives tracks a readable floor, panning what doesn't fit the way the phone already does
Browse files at this commit5af77e4eb318fc07b7137c4e89b067b2d98135b1Parent: 2117c604 changed files +140 -18
- crates/iz-web/src/board.rs +32 -5
- crates/iz-web/src/dropdown.rs +10 -1
- style/_instrument.scss +10 -0
- style/main.scss +88 -12
crates/iz-web/src/board.rsmodified+32 -5
| @@ -502,9 +502,15 @@ async fn render_card( | ||
| 502 | 502 | } |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | -/// Opens a card's context menu at the cursor and closes whichever one was | |
| 506 | -/// open; a plain document click closes it again. Rendered once — every | |
| 507 | -/// card's `@contextmenu` calls into this same global, by the menu's id. | |
| 505 | +/// Opens a card's context menu at the cursor — clamped inside the viewport | |
| 506 | +/// like `dropdown.rs`'s `place()`, with the move submenu flipped or pinned | |
| 507 | +/// to stay inside too; only JS knows the cursor and the viewport, so the | |
| 508 | +/// submenu's spot is computed here rather than left to its stylesheet's | |
| 509 | +/// `left: 100%`. The submenu is invisible until hover, so `placeSubmenus` | |
| 510 | +/// flashes each one open to measure — nothing paints mid-script. Closes | |
| 511 | +/// whichever one was open; a plain document click closes it again. Rendered | |
| 512 | +/// once — every card's `@contextmenu` calls into this same global, by the | |
| 513 | +/// menu's id. | |
| 508 | 514 | /// |
| 509 | 515 | /// Also registers the board page's own `Escape` resolvers on |
| 510 | 516 | /// `window.__izEsc`: the datepicker panel (priority 20 — below the |
| @@ -522,13 +528,34 @@ async fn card_menu_script(cx: &Cx) -> Result { | ||
| 522 | 528 | if (window.__izCardMenu) { return; } \ |
| 523 | 529 | window.__izCardMenu = true; \ |
| 524 | 530 | function closeCardMenus() { document.querySelectorAll('.card-menu-open').forEach(function (el) { el.classList.remove('card-menu-open'); }); } \ |
| 531 | + function placeSubmenus(menu) { \ | |
| 532 | + menu.querySelectorAll('.card-menu-submenu').forEach(function (sub) { \ | |
| 533 | + sub.style.display = 'block'; \ | |
| 534 | + var box = sub.getBoundingClientRect(); \ | |
| 535 | + var move = sub.parentElement.getBoundingClientRect(); \ | |
| 536 | + sub.style.display = ''; \ | |
| 537 | + var left = move.right + 4; \ | |
| 538 | + if (left + box.width > window.innerWidth - 4) { left = Math.max(4, move.left - 4 - box.width); } \ | |
| 539 | + var top = Math.max(4, Math.min(move.top, window.innerHeight - box.height - 4)); \ | |
| 540 | + sub.style.left = (left - move.left) + 'px'; \ | |
| 541 | + sub.style.top = (top - move.top) + 'px'; \ | |
| 542 | + sub.style.right = 'auto'; \ | |
| 543 | + sub.style.marginLeft = '0'; \ | |
| 544 | + sub.style.marginRight = '0'; \ | |
| 545 | + window.__izOwn(sub, [], ['style']); \ | |
| 546 | + }); \ | |
| 547 | + } \ | |
| 525 | 548 | window.__izOpenCardMenu = function (e, id) { \ |
| 526 | 549 | closeCardMenus(); \ |
| 527 | 550 | var menu = document.getElementById(id); \ |
| 528 | 551 | if (!menu) { return; } \ |
| 529 | - menu.style.left = e.clientX + 'px'; \ | |
| 530 | - menu.style.top = e.clientY + 'px'; \ | |
| 531 | 552 | window.__izOwn(menu, ['card-menu-open'], ['style']); \ |
| 553 | + var w = menu.offsetWidth, h = menu.offsetHeight; \ | |
| 554 | + var left = Math.max(4, Math.min(e.clientX, window.innerWidth - w - 4)); \ | |
| 555 | + var top = Math.max(4, Math.min(e.clientY, window.innerHeight - h - 4)); \ | |
| 556 | + menu.style.left = left + 'px'; \ | |
| 557 | + menu.style.top = top + 'px'; \ | |
| 558 | + placeSubmenus(menu); \ | |
| 532 | 559 | }; \ |
| 533 | 560 | document.addEventListener('click', closeCardMenus); \ |
| 534 | 561 | window.__izEsc.register(20, function () { \ |
crates/iz-web/src/dropdown.rsmodified+10 -1
| @@ -62,6 +62,10 @@ use topcoat::view::{Unescaped, view}; | ||
| 62 | 62 | /// with `?task=` registered it first and the modal chain won, closing |
| 63 | 63 | /// the whole modal over an open dropdown — the registry pins the correct |
| 64 | 64 | /// order; the whole table lives in `layout.rs`'s `escape_manager_script`). |
| 65 | +/// A panel's rows are `white-space: nowrap`, so a long option never wraps — | |
| 66 | +/// `place` caps the open panel's width at `innerWidth − 8`, shaving off the | |
| 67 | +/// padding and borders a `max-width` does not cover, or its right edge would | |
| 68 | +/// clip on a 320px phone no matter where the left clamp puts it. | |
| 65 | 69 | pub async fn dropdown_script(cx: &Cx) -> Result { |
| 66 | 70 | const JS: &str = "\ |
| 67 | 71 | (function () {\ |
| @@ -76,6 +80,11 @@ pub async fn dropdown_script(cx: &Cx) -> Result { | ||
| 76 | 80 | }\ |
| 77 | 81 | function place(panel, trigger) {\ |
| 78 | 82 | var r = trigger.getBoundingClientRect();\ |
| 83 | + var maxW = window.innerWidth - 8;\ | |
| 84 | + panel.style.maxWidth = '';\ | |
| 85 | + if (panel.offsetWidth > maxW) { panel.style.maxWidth = maxW + 'px'; }\ | |
| 86 | + var over = panel.offsetWidth - maxW;\ | |
| 87 | + if (over > 0) { panel.style.maxWidth = (maxW - over) + 'px'; }\ | |
| 79 | 88 | var h = panel.offsetHeight;\ |
| 80 | 89 | var w = panel.offsetWidth;\ |
| 81 | 90 | var top = r.bottom + 4;\ |
| @@ -84,7 +93,7 @@ pub async fn dropdown_script(cx: &Cx) -> Result { | ||
| 84 | 93 | var left = Math.max(4, Math.min(r.left, window.innerWidth - w - 4));\ |
| 85 | 94 | panel.style.left = left + 'px';\ |
| 86 | 95 | panel.style.top = top + 'px';\ |
| 87 | - panel.style.minWidth = r.width + 'px';\ | |
| 96 | + panel.style.minWidth = Math.min(r.width, maxW) + 'px';\ | |
| 88 | 97 | }\ |
| 89 | 98 | function visibleRows(panel) { return Array.prototype.slice.call(panel.querySelectorAll('.dd-option:not(.dd-option-hidden)')); }\ |
| 90 | 99 | function activate(panel, row) {\ |
style/_instrument.scssmodified+10 -0
| @@ -262,6 +262,16 @@ | ||
| 262 | 262 | padding: 14px 20px; |
| 263 | 263 | border-top: 1px solid var(--border); |
| 264 | 264 | } |
| 265 | + | |
| 266 | +// -- tablet band (621–1150px) ------------------------------------------------ | |
| 267 | +// The bar's content — New task, three selects, the search box, chips — runs | |
| 268 | +// 900–1100px and wraps below ~1150px, where the fixed 40px would clip the | |
| 269 | +// second row into the board; the mobile layer concedes the same at 620px. | |
| 270 | +// The upper edge sits past the shared 621–1024 band because wrap pressure, | |
| 271 | +// not the breakpoint grid, decides where one row still fits. | |
| 272 | +@media (min-width: 621px) and (max-width: 1150px) { | |
| 273 | + [data-ui="instrument"] .filterbar { height: auto; } | |
| 274 | +} | |
| 265 | 275 | // -- mobile (narrow viewports) ----------------------------------------------- |
| 266 | 276 | // Geometry that the skin sets with [data-ui]-prefixed rules and that the |
| 267 | 277 | // shared mobile layer in main.scss cannot out-specify. |
style/main.scssmodified+88 -12
| @@ -870,6 +870,9 @@ a { | ||
| 870 | 870 | font-weight: 600; |
| 871 | 871 | line-height: 1.4; |
| 872 | 872 | margin-top: 4px; |
| 873 | + // A pasted URL has no space to wrap at; without this it runs off the card | |
| 874 | + // instead of folding. | |
| 875 | + overflow-wrap: anywhere; | |
| 873 | 876 | } |
| 874 | 877 | |
| 875 | 878 | .card-foot { |
| @@ -1723,7 +1726,13 @@ img.avatar { | ||
| 1723 | 1726 | box-shadow: var(--shadow-2); |
| 1724 | 1727 | } |
| 1725 | 1728 | |
| 1726 | -.pop-panel-wide { min-width: 320px; } | |
| 1729 | +// The wide pickers hang off a trigger sitting at a panel's edge; a flat | |
| 1730 | +// 320px floor walks them past a phone's viewport, where the locked body | |
| 1731 | +// keeps them unreachable. The floor yields to the screen first. | |
| 1732 | +.pop-panel-wide { | |
| 1733 | + min-width: min(320px, calc(100dvw - 32px)); | |
| 1734 | + max-width: calc(100dvw - 32px); | |
| 1735 | +} | |
| 1727 | 1736 | |
| 1728 | 1737 | .pop-list { |
| 1729 | 1738 | display: flex; |
| @@ -1805,6 +1814,13 @@ img.avatar { | ||
| 1805 | 1814 | padding: 22px 24px 0; |
| 1806 | 1815 | } |
| 1807 | 1816 | |
| 1817 | +// The generic spacer grows, and here it once split the head's free width | |
| 1818 | +// with the headline fifty-fifty: a long title wrapped inside half the mast | |
| 1819 | +// while the other half sat empty. The headline's own flex already pushes | |
| 1820 | +// the trailing controls (status pill, close, board link) to the right edge, | |
| 1821 | +// so the spacer has nothing to do in this row. | |
| 1822 | +.detail-head > .spacer { flex-grow: 0; } | |
| 1823 | + | |
| 1808 | 1824 | .detail-headline { |
| 1809 | 1825 | flex: 1; |
| 1810 | 1826 | min-width: 0; |
| @@ -1917,6 +1933,9 @@ img.avatar { | ||
| 1917 | 1933 | font-weight: 600; |
| 1918 | 1934 | letter-spacing: -0.01em; |
| 1919 | 1935 | line-height: 1.3; |
| 1936 | + // Same trap as the prose: an unbroken run would push the head row wider | |
| 1937 | + // than the panel instead of folding. | |
| 1938 | + overflow-wrap: anywhere; | |
| 1920 | 1939 | } |
| 1921 | 1940 | |
| 1922 | 1941 | .title-form { |
| @@ -2779,6 +2798,9 @@ img.avatar { | ||
| 2779 | 2798 | line-height: 1.55; |
| 2780 | 2799 | color: var(--ink-soft); |
| 2781 | 2800 | white-space: pre-wrap; |
| 2801 | + // pre-wrap keeps the author's lines but still needs somewhere to break | |
| 2802 | + // a run that never ends. | |
| 2803 | + overflow-wrap: anywhere; | |
| 2782 | 2804 | } |
| 2783 | 2805 | |
| 2784 | 2806 | .comment-composer { |
| @@ -3309,6 +3331,18 @@ input[type="radio"] { | ||
| 3309 | 3331 | |
| 3310 | 3332 | // -- the member list -------------------------------------------------------- |
| 3311 | 3333 | |
| 3334 | +// The members register keeps its named columns and pans inside the panel | |
| 3335 | +// rather than squeezing the role select out of the screen. Panning is not a | |
| 3336 | +// phone rescue: a mid-size window squeezes the same way. | |
| 3337 | +.table-pan { | |
| 3338 | + overflow-x: auto; | |
| 3339 | + scrollbar-width: none; | |
| 3340 | + | |
| 3341 | + &::-webkit-scrollbar { display: none; } | |
| 3342 | + | |
| 3343 | + .member-table { min-width: 560px; } | |
| 3344 | +} | |
| 3345 | + | |
| 3312 | 3346 | // The columns are named, not counted, and only one of them is elastic. |
| 3313 | 3347 | // |
| 3314 | 3348 | // This was `table-layout: fixed` with a single hardcoded `width: 30%` on the |
| @@ -4132,6 +4166,16 @@ input[type="radio"] { | ||
| 4132 | 4166 | } |
| 4133 | 4167 | |
| 4134 | 4168 | .topbar-nav-links { gap: 10px; } |
| 4169 | + | |
| 4170 | + // The stamp is a clock reading, not the news; below the smallest common | |
| 4171 | + // phone it gives up its width and ends in an ellipsis, one line. | |
| 4172 | + .log-stamp { | |
| 4173 | + flex-shrink: 1; | |
| 4174 | + min-width: 0; | |
| 4175 | + overflow: hidden; | |
| 4176 | + text-overflow: ellipsis; | |
| 4177 | + white-space: nowrap; | |
| 4178 | + } | |
| 4135 | 4179 | } |
| 4136 | 4180 | |
| 4137 | 4181 | // -- board ----------------------------------------------------------------- |
| @@ -4199,6 +4243,16 @@ input[type="radio"] { | ||
| 4199 | 4243 | |
| 4200 | 4244 | .detail-foot { padding: 14px 16px 16px; } |
| 4201 | 4245 | |
| 4246 | + // -- popovers ---------------------------------------------------------------- | |
| 4247 | + | |
| 4248 | + // The datepick hangs from the right end of the filter row; anchored left | |
| 4249 | + // it opens past the panel's clipped edge. Anchor it right, the way the | |
| 4250 | + // assignee pop already is. | |
| 4251 | + .datepick-pop .edit-form { | |
| 4252 | + left: auto; | |
| 4253 | + right: 0; | |
| 4254 | + } | |
| 4255 | + | |
| 4202 | 4256 | // -- the settings shell: rail becomes a strip ------------------------------- |
| 4203 | 4257 | |
| 4204 | 4258 | .settings-shell { flex-direction: column; } |
| @@ -4223,17 +4277,6 @@ input[type="radio"] { | ||
| 4223 | 4277 | |
| 4224 | 4278 | .settings-stage { padding: 16px 16px 32px; } |
| 4225 | 4279 | |
| 4226 | - // The members register keeps its named columns and pans inside the panel | |
| 4227 | - // rather than squeezing the role select out of the screen. | |
| 4228 | - .table-pan { | |
| 4229 | - overflow-x: auto; | |
| 4230 | - scrollbar-width: none; | |
| 4231 | - | |
| 4232 | - &::-webkit-scrollbar { display: none; } | |
| 4233 | - | |
| 4234 | - .member-table { min-width: 560px; } | |
| 4235 | - } | |
| 4236 | - | |
| 4237 | 4280 | .field-row { flex-wrap: wrap; } |
| 4238 | 4281 | |
| 4239 | 4282 | // -- people ----------------------------------------------------------------- |
| @@ -4259,3 +4302,36 @@ input[type="radio"] { | ||
| 4259 | 4302 | |
| 4260 | 4303 | .auth-stage { padding: 0 16px 24px; } |
| 4261 | 4304 | } |
| 4305 | + | |
| 4306 | +// --- Tablet (between the phone fold and the desktop) ------------------------ | |
| 4307 | +// | |
| 4308 | +// The desktop layout holds here, but its evenly shared columns and fields | |
| 4309 | +// run short of room: a track keeps a floor to stay readable, and what does | |
| 4310 | +// not fit pans inside its region, the way it does on a phone. No document | |
| 4311 | +// scrollbar opens here either. | |
| 4312 | +@media (min-width: 621px) and (max-width: 1024px) { | |
| 4313 | + | |
| 4314 | + // -- board ----------------------------------------------------------------- | |
| 4315 | + | |
| 4316 | + // Five or seven columns shared across a 620-something window are 90px | |
| 4317 | + // slivers. Each keeps a card's width instead; the row pans sideways under | |
| 4318 | + // the finger, silently, as the phone rail already does. | |
| 4319 | + .board-columns { | |
| 4320 | + grid-template-columns: none; | |
| 4321 | + grid-auto-flow: column; | |
| 4322 | + grid-auto-columns: minmax(180px, 1fr); | |
| 4323 | + overflow-x: auto; | |
| 4324 | + scroll-snap-type: x proximity; | |
| 4325 | + scrollbar-width: none; | |
| 4326 | + | |
| 4327 | + &::-webkit-scrollbar { display: none; } | |
| 4328 | + } | |
| 4329 | + | |
| 4330 | + .column { scroll-snap-align: start; } | |
| 4331 | + | |
| 4332 | + // -- settings ---------------------------------------------------------------- | |
| 4333 | + | |
| 4334 | + // The rail keeps its width; two fields that no longer have the room for | |
| 4335 | + // their columns stack instead of squeezing into slivers. | |
| 4336 | + .field-row { flex-wrap: wrap; } | |
| 4337 | +} |