diff --git a/crates/iz-web/src/board.rs b/crates/iz-web/src/board.rs index 5f3c39f..df2eafa 100644 --- a/crates/iz-web/src/board.rs +++ b/crates/iz-web/src/board.rs @@ -502,9 +502,15 @@ async fn render_card( } } -/// Opens a card's context menu at the cursor and closes whichever one was -/// open; a plain document click closes it again. Rendered once — every -/// card's `@contextmenu` calls into this same global, by the menu's id. +/// Opens a card's context menu at the cursor — clamped inside the viewport +/// like `dropdown.rs`'s `place()`, with the move submenu flipped or pinned +/// to stay inside too; only JS knows the cursor and the viewport, so the +/// submenu's spot is computed here rather than left to its stylesheet's +/// `left: 100%`. The submenu is invisible until hover, so `placeSubmenus` +/// flashes each one open to measure — nothing paints mid-script. Closes +/// whichever one was open; a plain document click closes it again. Rendered +/// once — every card's `@contextmenu` calls into this same global, by the +/// menu's id. /// /// Also registers the board page's own `Escape` resolvers on /// `window.__izEsc`: the datepicker panel (priority 20 — below the @@ -522,13 +528,34 @@ async fn card_menu_script(cx: &Cx) -> Result { if (window.__izCardMenu) { return; } \ window.__izCardMenu = true; \ function closeCardMenus() { document.querySelectorAll('.card-menu-open').forEach(function (el) { el.classList.remove('card-menu-open'); }); } \ + function placeSubmenus(menu) { \ + menu.querySelectorAll('.card-menu-submenu').forEach(function (sub) { \ + sub.style.display = 'block'; \ + var box = sub.getBoundingClientRect(); \ + var move = sub.parentElement.getBoundingClientRect(); \ + sub.style.display = ''; \ + var left = move.right + 4; \ + if (left + box.width > window.innerWidth - 4) { left = Math.max(4, move.left - 4 - box.width); } \ + var top = Math.max(4, Math.min(move.top, window.innerHeight - box.height - 4)); \ + sub.style.left = (left - move.left) + 'px'; \ + sub.style.top = (top - move.top) + 'px'; \ + sub.style.right = 'auto'; \ + sub.style.marginLeft = '0'; \ + sub.style.marginRight = '0'; \ + window.__izOwn(sub, [], ['style']); \ + }); \ + } \ window.__izOpenCardMenu = function (e, id) { \ closeCardMenus(); \ var menu = document.getElementById(id); \ if (!menu) { return; } \ - menu.style.left = e.clientX + 'px'; \ - menu.style.top = e.clientY + 'px'; \ window.__izOwn(menu, ['card-menu-open'], ['style']); \ + var w = menu.offsetWidth, h = menu.offsetHeight; \ + var left = Math.max(4, Math.min(e.clientX, window.innerWidth - w - 4)); \ + var top = Math.max(4, Math.min(e.clientY, window.innerHeight - h - 4)); \ + menu.style.left = left + 'px'; \ + menu.style.top = top + 'px'; \ + placeSubmenus(menu); \ }; \ document.addEventListener('click', closeCardMenus); \ window.__izEsc.register(20, function () { \ diff --git a/crates/iz-web/src/dropdown.rs b/crates/iz-web/src/dropdown.rs index 5aa9a57..af1faca 100644 --- a/crates/iz-web/src/dropdown.rs +++ b/crates/iz-web/src/dropdown.rs @@ -62,6 +62,10 @@ use topcoat::view::{Unescaped, view}; /// with `?task=` registered it first and the modal chain won, closing /// the whole modal over an open dropdown — the registry pins the correct /// order; the whole table lives in `layout.rs`'s `escape_manager_script`). +/// A panel's rows are `white-space: nowrap`, so a long option never wraps — +/// `place` caps the open panel's width at `innerWidth − 8`, shaving off the +/// padding and borders a `max-width` does not cover, or its right edge would +/// clip on a 320px phone no matter where the left clamp puts it. pub async fn dropdown_script(cx: &Cx) -> Result { const JS: &str = "\ (function () {\ @@ -76,6 +80,11 @@ pub async fn dropdown_script(cx: &Cx) -> Result { }\ function place(panel, trigger) {\ var r = trigger.getBoundingClientRect();\ + var maxW = window.innerWidth - 8;\ + panel.style.maxWidth = '';\ + if (panel.offsetWidth > maxW) { panel.style.maxWidth = maxW + 'px'; }\ + var over = panel.offsetWidth - maxW;\ + if (over > 0) { panel.style.maxWidth = (maxW - over) + 'px'; }\ var h = panel.offsetHeight;\ var w = panel.offsetWidth;\ var top = r.bottom + 4;\ @@ -84,7 +93,7 @@ pub async fn dropdown_script(cx: &Cx) -> Result { var left = Math.max(4, Math.min(r.left, window.innerWidth - w - 4));\ panel.style.left = left + 'px';\ panel.style.top = top + 'px';\ - panel.style.minWidth = r.width + 'px';\ + panel.style.minWidth = Math.min(r.width, maxW) + 'px';\ }\ function visibleRows(panel) { return Array.prototype.slice.call(panel.querySelectorAll('.dd-option:not(.dd-option-hidden)')); }\ function activate(panel, row) {\ diff --git a/style/_instrument.scss b/style/_instrument.scss index 3446050..14e4e9e 100644 --- a/style/_instrument.scss +++ b/style/_instrument.scss @@ -262,6 +262,16 @@ padding: 14px 20px; border-top: 1px solid var(--border); } + +// -- tablet band (621–1150px) ------------------------------------------------ +// The bar's content — New task, three selects, the search box, chips — runs +// 900–1100px and wraps below ~1150px, where the fixed 40px would clip the +// second row into the board; the mobile layer concedes the same at 620px. +// The upper edge sits past the shared 621–1024 band because wrap pressure, +// not the breakpoint grid, decides where one row still fits. +@media (min-width: 621px) and (max-width: 1150px) { + [data-ui="instrument"] .filterbar { height: auto; } +} // -- mobile (narrow viewports) ----------------------------------------------- // Geometry that the skin sets with [data-ui]-prefixed rules and that the // shared mobile layer in main.scss cannot out-specify. diff --git a/style/main.scss b/style/main.scss index 12ba7e9..fa2d241 100644 --- a/style/main.scss +++ b/style/main.scss @@ -870,6 +870,9 @@ a { font-weight: 600; line-height: 1.4; margin-top: 4px; + // A pasted URL has no space to wrap at; without this it runs off the card + // instead of folding. + overflow-wrap: anywhere; } .card-foot { @@ -1723,7 +1726,13 @@ img.avatar { box-shadow: var(--shadow-2); } -.pop-panel-wide { min-width: 320px; } +// The wide pickers hang off a trigger sitting at a panel's edge; a flat +// 320px floor walks them past a phone's viewport, where the locked body +// keeps them unreachable. The floor yields to the screen first. +.pop-panel-wide { + min-width: min(320px, calc(100dvw - 32px)); + max-width: calc(100dvw - 32px); +} .pop-list { display: flex; @@ -1805,6 +1814,13 @@ img.avatar { padding: 22px 24px 0; } +// The generic spacer grows, and here it once split the head's free width +// with the headline fifty-fifty: a long title wrapped inside half the mast +// while the other half sat empty. The headline's own flex already pushes +// the trailing controls (status pill, close, board link) to the right edge, +// so the spacer has nothing to do in this row. +.detail-head > .spacer { flex-grow: 0; } + .detail-headline { flex: 1; min-width: 0; @@ -1917,6 +1933,9 @@ img.avatar { font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; + // Same trap as the prose: an unbroken run would push the head row wider + // than the panel instead of folding. + overflow-wrap: anywhere; } .title-form { @@ -2779,6 +2798,9 @@ img.avatar { line-height: 1.55; color: var(--ink-soft); white-space: pre-wrap; + // pre-wrap keeps the author's lines but still needs somewhere to break + // a run that never ends. + overflow-wrap: anywhere; } .comment-composer { @@ -3309,6 +3331,18 @@ input[type="radio"] { // -- the member list -------------------------------------------------------- +// The members register keeps its named columns and pans inside the panel +// rather than squeezing the role select out of the screen. Panning is not a +// phone rescue: a mid-size window squeezes the same way. +.table-pan { + overflow-x: auto; + scrollbar-width: none; + + &::-webkit-scrollbar { display: none; } + + .member-table { min-width: 560px; } +} + // The columns are named, not counted, and only one of them is elastic. // // This was `table-layout: fixed` with a single hardcoded `width: 30%` on the @@ -4132,6 +4166,16 @@ input[type="radio"] { } .topbar-nav-links { gap: 10px; } + + // The stamp is a clock reading, not the news; below the smallest common + // phone it gives up its width and ends in an ellipsis, one line. + .log-stamp { + flex-shrink: 1; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } } // -- board ----------------------------------------------------------------- @@ -4199,6 +4243,16 @@ input[type="radio"] { .detail-foot { padding: 14px 16px 16px; } + // -- popovers ---------------------------------------------------------------- + + // The datepick hangs from the right end of the filter row; anchored left + // it opens past the panel's clipped edge. Anchor it right, the way the + // assignee pop already is. + .datepick-pop .edit-form { + left: auto; + right: 0; + } + // -- the settings shell: rail becomes a strip ------------------------------- .settings-shell { flex-direction: column; } @@ -4223,17 +4277,6 @@ input[type="radio"] { .settings-stage { padding: 16px 16px 32px; } - // The members register keeps its named columns and pans inside the panel - // rather than squeezing the role select out of the screen. - .table-pan { - overflow-x: auto; - scrollbar-width: none; - - &::-webkit-scrollbar { display: none; } - - .member-table { min-width: 560px; } - } - .field-row { flex-wrap: wrap; } // -- people ----------------------------------------------------------------- @@ -4259,3 +4302,36 @@ input[type="radio"] { .auth-stage { padding: 0 16px 24px; } } + +// --- Tablet (between the phone fold and the desktop) ------------------------ +// +// The desktop layout holds here, but its evenly shared columns and fields +// run short of room: a track keeps a floor to stay readable, and what does +// not fit pans inside its region, the way it does on a phone. No document +// scrollbar opens here either. +@media (min-width: 621px) and (max-width: 1024px) { + + // -- board ----------------------------------------------------------------- + + // Five or seven columns shared across a 620-something window are 90px + // slivers. Each keeps a card's width instead; the row pans sideways under + // the finger, silently, as the phone rail already does. + .board-columns { + grid-template-columns: none; + grid-auto-flow: column; + grid-auto-columns: minmax(180px, 1fr); + overflow-x: auto; + scroll-snap-type: x proximity; + scrollbar-width: none; + + &::-webkit-scrollbar { display: none; } + } + + .column { scroll-snap-align: start; } + + // -- settings ---------------------------------------------------------------- + + // The rail keeps its width; two fields that no longer have the room for + // their columns stack instead of squeezing into slivers. + .field-row { flex-wrap: wrap; } +}