From eff59e7a65789de1ce7560c26daf618833a40120 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Mon, 30 Nov 2026 15:39:31 -0500 Subject: [PATCH 1/4] fix(menus): keep bar menus and their submenus under the bar (0.47.0) MenuBar.open used openAt, the right-click routine, which flipped a menu that did not fit above its point and clamped it to 4 px from the window top, so a long menu in a short window covered the bar. Submenus clamped to the window top as well. Bar menus now open with openUnder: the top is the button's bottom edge plus 4, never moved up, and max-height is menuCap(y), the smaller of 75% of the window and the room to its bottom, set while hidden and before measuring. openBeside takes the root menu's floor and the same cap, and never places a submenu above the floor. Run: tsc --noEmit. --- frontend/HASHOUT_LOG.md | 21 +++++++++++++++++++++ frontend/src/ui/menu.ts | 29 +++++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md index 323da1d..e416c6f 100644 --- a/frontend/HASHOUT_LOG.md +++ b/frontend/HASHOUT_LOG.md @@ -8,6 +8,7 @@ - [Stacking scale](#stacking-scale) - [Verification](#verification) - [Scripts](#scripts) +- [v0.47.0 · Bar menus stay under the bar](#v0470--bar-menus-stay-under-the-bar) - [Unreleased · Settings > About shows the third-party licence texts](#unreleased--settings--about-shows-the-third-party-licence-texts) - [Unreleased · The page holds the window key](#unreleased--the-page-holds-the-window-key) - [Unreleased · A reload tries the kept key first](#unreleased--a-reload-tries-the-kept-key-first) @@ -76,6 +77,26 @@ - [v0.4.7 synced notes, map cards, inline edit commit](#v047-synced-notes-map-cards-inline-edit-commit) - [v0.4.6 GIF frames and document export](#v046-gif-frames-and-document-export) +## v0.47.0 · Bar menus stay under the bar + +- refers-to: `src/ui/menu.ts` :: MENU_SHARE, MENU_PAD, menuCap, PopupMenu.floor, PopupMenu.openUnder, PopupMenu.openBeside, MenuBar.open + +FORM-MENU-OVERLAP-FIX 1.2.0, rules 1 to 4. `MenuBar.open` placed its menus with `openAt`, the right-click routine. Its cap was the room under the point with a 120 px minimum, and when the menu still did not fit it was flipped above the point and clamped to 4 px from the window top, so in a short window a long menu (Edit, View) covered the bar. Submenus clamped their top to 4 px from the window top too, and had no cap of their own beyond the stylesheet's `calc(100vh - 8px)`. + +`openUnder` is the bar's routine now: the top is the button's bottom edge plus 4 and nothing moves it up; `max-height` is `menuCap(y)`, the smaller of three quarters of the window and the room down to 4 px from the bottom, set while the panel is `visibility: hidden` and before it is measured, so it never paints at another size. The menu keeps that top as its `floor`. `openBeside` reads the floor of the root menu, takes the same cap before measuring and never places a submenu above the floor; it still opens beside its row. The window closes an open menu on resize, which is how the cap follows the window height. Removed from `MenuBar.open` and `openBeside`: + +```ts +b.menu.openAt(r.left, r.bottom + 4); +``` + +```ts +this.panel.scrollTop = 0; +const w = this.panel.offsetWidth, h = this.panel.offsetHeight, pad = 4; +const right = row.right - 2, left = row.left - w + 2; +const x = right + w <= window.innerWidth - pad ? right : Math.max(pad, left); +const y = Math.max(pad, Math.min(row.top - pad, window.innerHeight - h - pad)); +``` + ## Unreleased · Settings > About shows the third-party licence texts - refers-to: `src/ui/notices.ts` (new) :: registerNotices; `src/main.ts`; `index.html` :: #third-party-notices; `src/styles/prefs.css` :: .prefs-notices, .prefs-notices-text; `src/lib/i18n/tables/*.json` diff --git a/frontend/src/ui/menu.ts b/frontend/src/ui/menu.ts index 0350d76..bf5ffeb 100644 --- a/frontend/src/ui/menu.ts +++ b/frontend/src/ui/menu.ts @@ -34,6 +34,9 @@ function setText(node: HTMLElement, text: string): void { if (node.textContent ! function setClass(node: Element, name: string, on: boolean): void { if (node.classList.contains(name) !== on) node.classList.toggle(name, on); } function setDisabled(node: HTMLButtonElement, on: boolean): void { if (node.disabled !== on) node.disabled = on; } +const MENU_SHARE = 0.75, MENU_PAD = 4; +export const menuCap = (top: number): number => Math.max(0, Math.min(Math.floor(window.innerHeight * MENU_SHARE), Math.floor(window.innerHeight - top - MENU_PAD))); + /** Items without the ids no command answers to; a submenu left empty goes too, and no separator is left leading, trailing or doubled. */ export function trimMenu(items: MenuItem[], commands: MenuCommands): MenuItem[] { const out: MenuItem[] = []; @@ -55,6 +58,7 @@ export class PopupMenu { private key = ''; private openSub: PopupMenu | null = null; private subTop = 0; + private floor: number | null = null; onClose: (() => void) | null = null; constructor(private readonly commands: MenuCommands, private readonly parent: PopupMenu | null = null) { @@ -164,16 +168,33 @@ export class PopupMenu { this.panel.style.visibility = ''; } - /** A submenu beside its row: to the right, or to the left when the right has no room. */ + /** A bar menu just under its button: never moved up, capped to three quarters of the window and the room below, the rest scrolls. */ + openUnder(x: number, y: number): void { + this.floor = y; + this.refresh(); + this.panel.style.visibility = 'hidden'; + this.panel.hidden = false; + this.panel.style.maxHeight = `${menuCap(y)}px`; + this.panel.scrollTop = 0; + const w = this.panel.offsetWidth; + const left = Math.max(MENU_PAD, Math.min(x, window.innerWidth - w - MENU_PAD)); + this.panel.style.left = `${Math.round(left)}px`; + this.panel.style.top = `${Math.round(y)}px`; + this.panel.style.visibility = ''; + } + + /** A submenu beside its row: to the right, or to the left when the right has no room; never above its root menu's floor. */ private openBeside(row: DOMRect): void { this.refresh(); this.panel.style.visibility = 'hidden'; this.panel.hidden = false; + const floor = this.root().floor, pad = MENU_PAD; + this.panel.style.maxHeight = floor === null ? '' : `${menuCap(floor)}px`; this.panel.scrollTop = 0; - const w = this.panel.offsetWidth, h = this.panel.offsetHeight, pad = 4; + const w = this.panel.offsetWidth, h = this.panel.offsetHeight; const right = row.right - 2, left = row.left - w + 2; const x = right + w <= window.innerWidth - pad ? right : Math.max(pad, left); - const y = Math.max(pad, Math.min(row.top - pad, window.innerHeight - h - pad)); + const y = Math.max(floor ?? pad, Math.min(row.top - pad, window.innerHeight - h - pad)); this.panel.style.left = `${Math.round(x)}px`; this.panel.style.top = `${Math.round(y)}px`; this.panel.style.visibility = ''; @@ -346,7 +367,7 @@ export class MenuBar { this.openIndex = i; setClass(b.btn, 'is-open', true); const r = b.btn.getBoundingClientRect(); - b.menu.openAt(r.left, r.bottom + 4); + b.menu.openUnder(r.left, r.bottom + 4); if (keyboard) b.menu.items()[0]?.focus(); } From d14e5d924d408b4bc039fd796d8bc390146eb3da Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Mon, 30 Nov 2026 15:40:28 -0500 Subject: [PATCH 2/4] feat(menus): show a more-below hint on a cut-off menu (0.47.0) A bar menu or submenu that is cut off by the cap fades its last rows into the menu's own background and shows a small pill with a down chevron at its bottom while rows remain below. It is in place when the menu opens, fades out in 160 ms at the last row and back in over 490 ms, and switches with no fade under reduced motion. The panel becomes a card holding a scrolling .menu-list and the .menu-more pill; the mask sits on the list so the card's border and shadow stay as they were. Run: tsc --noEmit. --- frontend/HASHOUT_LOG.md | 18 ++++++++++++++++++ frontend/src/styles/shell.css | 11 ++++++++++- frontend/src/ui/menu.ts | 35 ++++++++++++++++++++++++----------- 3 files changed, 52 insertions(+), 12 deletions(-) diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md index e416c6f..f4d04bb 100644 --- a/frontend/HASHOUT_LOG.md +++ b/frontend/HASHOUT_LOG.md @@ -8,6 +8,7 @@ - [Stacking scale](#stacking-scale) - [Verification](#verification) - [Scripts](#scripts) +- [v0.47.0 · The more-below hint](#v0470--the-more-below-hint) - [v0.47.0 · Bar menus stay under the bar](#v0470--bar-menus-stay-under-the-bar) - [Unreleased · Settings > About shows the third-party licence texts](#unreleased--settings--about-shows-the-third-party-licence-texts) - [Unreleased · The page holds the window key](#unreleased--the-page-holds-the-window-key) @@ -77,6 +78,23 @@ - [v0.4.7 synced notes, map cards, inline edit commit](#v047-synced-notes-map-cards-inline-edit-commit) - [v0.4.6 GIF frames and document export](#v046-gif-frames-and-document-export) +## v0.47.0 · The more-below hint + +- refers-to: `src/ui/menu.ts` :: PopupMenu.list, the constructor, setItems, items, showSub, openAt, openUnder, openBeside, showMore; `src/styles/shell.css` :: `.menu`, `--menu-more`, `.menu-list`, `.menu-more`, `.has-more`, `.no-fade` + +FORM-MENU-OVERLAP-FIX 1.2.0, rule 8 and section 3a. A bar menu or submenu cut off by the cap shows a fade over its last rows and a 56 by 12 px pill with a thin down chevron, 6 px above its bottom edge, while rows remain below. The panel is now a card that does not scroll, holding `.menu-list`, which does, and the pill. The fade is a `mask-image` on the list, so the rows fade into the card's own `--bg-node` and the border and shadow are untouched; a gradient painted over the rows, or a mask on the card, would show as a band or fade the card. The pill takes `--glass-bg`, `--glass-border` and `--text-secondary` and cannot be clicked. + +`--menu-more` is a registered `@property` so the mask can animate: out over 160 ms at the last row (the base rule), back in over 490 ms (`.has-more`), since the transition of the state entered is the one that runs. `showMore(true)` runs while the panel is still `visibility: hidden`, with `no-fade` on for one forced style read, so a menu opens with the hint already in place and never fades it in. `scroll-padding-block-end` keeps a row focused with the arrow keys out of the fade. Reduced motion shows and hides it with no fade. Rows, separators and submenu rows go into the list; `items()`, `subTop` and every `scrollTop = 0` read the list. Nothing outside `menu.ts` reads the panel's children or `scrollTop`. Removed from the constructor and from `.menu`: + +```ts +this.panel = el(''); +this.panel.addEventListener('scroll', () => { if (this.panel.scrollTop !== this.subTop) this.closeSub(); }, { passive: true }); +``` + +```css +overflow-y: auto; overscroll-behavior: contain; +``` + ## v0.47.0 · Bar menus stay under the bar - refers-to: `src/ui/menu.ts` :: MENU_SHARE, MENU_PAD, menuCap, PopupMenu.floor, PopupMenu.openUnder, PopupMenu.openBeside, MenuBar.open diff --git a/frontend/src/styles/shell.css b/frontend/src/styles/shell.css index e62bcb0..453287d 100644 --- a/frontend/src/styles/shell.css +++ b/frontend/src/styles/shell.css @@ -51,7 +51,7 @@ .menu-btn { height: 28px; padding: 0 var(--space-2); border: 0; border-radius: var(--radius); background: transparent; color: var(--text-secondary); font-size: 12px; white-space: nowrap; cursor: default; } .menu-btn:hover, .menu-btn.is-open, .menu-btn:focus-visible { background: var(--bg-hover); color: var(--text-primary); } .is-menu-mnemonics .menu-btn::first-letter { text-decoration: underline; } -.menu { position: fixed; z-index: var(--z-dropdown); min-width: 232px; max-width: 360px; max-height: calc(100vh - 8px); overflow-y: auto; overscroll-behavior: contain; padding: var(--space-1); background: var(--bg-node); border: 1px solid var(--glass-border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); color: var(--text-primary); font-size: 12px; } +.menu { position: fixed; z-index: var(--z-dropdown); min-width: 232px; max-width: 360px; max-height: calc(100vh - 8px); overflow: hidden; padding: var(--space-1); background: var(--bg-node); border: 1px solid var(--glass-border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); color: var(--text-primary); font-size: 12px; } .menu-item { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; column-gap: var(--space-2); width: 100%; height: 28px; padding: 0 var(--space-2); border: 0; border-radius: var(--radius-sm); background: none; color: inherit; font: inherit; text-align: left; cursor: default; } .menu-item:hover:not(:disabled), .menu-item:focus:not(:disabled), .menu-sub.is-open:not(:disabled) { background: var(--accent-soft); color: var(--text-primary); outline: none; } .menu-item:disabled { color: var(--text-muted); opacity: .55; } @@ -62,6 +62,15 @@ .menu-keys { display: inline-flex; align-items: center; padding-left: var(--space-4); color: var(--text-muted); font-size: 10px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; } .menu-sub .menu-keys svg { width: 12px; height: 12px; } .menu-sep { height: 1px; margin: var(--space-1) var(--space-2); background: var(--border-color); } +@property --menu-more { syntax: ''; inherits: false; initial-value: 0; } +.menu:not([hidden]) { display: flex; flex-direction: column; } +.menu-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; --menu-more: 0; -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - min(88px, 40%)), rgb(0 0 0 / calc(1 - var(--menu-more))) calc(100% - min(22px, 10%))); mask-image: linear-gradient(to bottom, #000 calc(100% - min(88px, 40%)), rgb(0 0 0 / calc(1 - var(--menu-more))) calc(100% - min(22px, 10%))); transition: --menu-more 160ms ease-out; } +.menu-more { position: absolute; left: 50%; bottom: 6px; width: 56px; height: 12px; margin-left: -28px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--glass-border); border-radius: 999px; background: var(--glass-bg); color: var(--text-secondary); pointer-events: none; opacity: 0; transition: opacity 160ms ease-out; } +.menu-more svg { width: 12px; height: 8px; } +.menu.has-more > .menu-list { --menu-more: 1; scroll-padding-block-end: min(88px, 40%); transition-duration: 490ms; } +.menu.has-more > .menu-more { opacity: 1; transition-duration: 490ms; } +.menu.no-fade > .menu-list, .menu.no-fade > .menu-more { transition: none; } +@media (prefers-reduced-motion: reduce) { .menu-list, .menu-more { transition: none; } } .dock { position: relative; overflow: hidden; } .workspace > .editor { grid-column: 2; } diff --git a/frontend/src/ui/menu.ts b/frontend/src/ui/menu.ts index bf5ffeb..57cc6a0 100644 --- a/frontend/src/ui/menu.ts +++ b/frontend/src/ui/menu.ts @@ -53,6 +53,7 @@ export const itemsOf = (def: MenuDef, commands: MenuCommands): MenuItem[] => tri export class PopupMenu { readonly panel: HTMLElement; + private readonly list: HTMLElement; private rows: Array<{ id: string; node: HTMLButtonElement }> = []; private subs: Array<{ sub: SubMenu; node: HTMLButtonElement; menu: PopupMenu }> = []; private key = ''; @@ -62,10 +63,11 @@ export class PopupMenu { onClose: (() => void) | null = null; constructor(private readonly commands: MenuCommands, private readonly parent: PopupMenu | null = null) { - this.panel = el(''); + this.panel = el(''); + this.list = q(this.panel, '.menu-list'); document.getElementById('overlay-root')?.appendChild(this.panel); this.panel.addEventListener('contextmenu', (e) => e.preventDefault()); - this.panel.addEventListener('scroll', () => { if (this.panel.scrollTop !== this.subTop) this.closeSub(); }, { passive: true }); + this.list.addEventListener('scroll', () => { if (this.list.scrollTop !== this.subTop) this.closeSub(); this.showMore(); }, { passive: true }); } get isOpen(): boolean { return !this.panel.hidden; } @@ -78,11 +80,11 @@ export class PopupMenu { this.key = key; this.closeSub(); for (const s of this.subs) s.menu.dispose(); - this.panel.replaceChildren(); + this.list.replaceChildren(); this.rows = []; this.subs = []; for (const item of items) { - if (item === '-') { this.panel.appendChild(el('')); continue; } + if (item === '-') { this.list.appendChild(el('')); continue; } if (isSub(item)) { const node = el(''); q(node, '.menu-keys').append(icon('chevron-right')); @@ -92,7 +94,7 @@ export class PopupMenu { node.addEventListener('pointerenter', () => this.showSub(menu, node)); node.addEventListener('click', () => this.showSub(menu, node)); this.subs.push({ sub: item, node, menu }); - this.panel.appendChild(node); + this.list.appendChild(node); continue; } const cmd = this.commands.get(item); @@ -102,7 +104,7 @@ export class PopupMenu { node.addEventListener('pointerenter', () => this.closeSub()); node.addEventListener('click', () => { this.root().close(); this.commands.run(item); }); this.rows.push({ id: item, node }); - this.panel.appendChild(node); + this.list.appendChild(node); } } @@ -114,7 +116,7 @@ export class PopupMenu { private root(): PopupMenu { let m: PopupMenu = this; while (m.parent) m = m.parent; return m; } /** The rows a key can reach, in order: the enabled commands and submenu rows. */ - items(): HTMLButtonElement[] { return Array.from(this.panel.children).filter((n): n is HTMLButtonElement => n instanceof HTMLButtonElement && !n.disabled); } + items(): HTMLButtonElement[] { return Array.from(this.list.children).filter((n): n is HTMLButtonElement => n instanceof HTMLButtonElement && !n.disabled); } /** This menu or, following the open submenus, the innermost one showing. */ deepest(): PopupMenu { let m: PopupMenu = this; while (m.openSub?.isOpen) m = m.openSub; return m; } @@ -140,7 +142,7 @@ export class PopupMenu { if (this.openSub === menu && menu.isOpen) return; this.closeSub(); this.openSub = menu; - this.subTop = this.panel.scrollTop; + this.subTop = this.list.scrollTop; setClass(row, 'is-open', true); menu.onClose = () => setClass(row, 'is-open', false); menu.openBeside(row.getBoundingClientRect()); @@ -158,7 +160,7 @@ export class PopupMenu { this.panel.style.maxHeight = `${Math.max(120, window.innerHeight - y - 4)}px`; this.panel.style.visibility = 'hidden'; this.panel.hidden = false; - this.panel.scrollTop = 0; + this.list.scrollTop = 0; const { width: w, height: h } = this.panel.getBoundingClientRect(); const fitsRight = x + w <= window.innerWidth - 4, fitsBelow = y + h <= window.innerHeight - 4; const left = Math.max(4, Math.min(fitsRight ? x : x - w, window.innerWidth - w - 4)); @@ -175,11 +177,12 @@ export class PopupMenu { this.panel.style.visibility = 'hidden'; this.panel.hidden = false; this.panel.style.maxHeight = `${menuCap(y)}px`; - this.panel.scrollTop = 0; + this.list.scrollTop = 0; const w = this.panel.offsetWidth; const left = Math.max(MENU_PAD, Math.min(x, window.innerWidth - w - MENU_PAD)); this.panel.style.left = `${Math.round(left)}px`; this.panel.style.top = `${Math.round(y)}px`; + this.showMore(true); this.panel.style.visibility = ''; } @@ -190,16 +193,26 @@ export class PopupMenu { this.panel.hidden = false; const floor = this.root().floor, pad = MENU_PAD; this.panel.style.maxHeight = floor === null ? '' : `${menuCap(floor)}px`; - this.panel.scrollTop = 0; + this.list.scrollTop = 0; const w = this.panel.offsetWidth, h = this.panel.offsetHeight; const right = row.right - 2, left = row.left - w + 2; const x = right + w <= window.innerWidth - pad ? right : Math.max(pad, left); const y = Math.max(floor ?? pad, Math.min(row.top - pad, window.innerHeight - h - pad)); this.panel.style.left = `${Math.round(x)}px`; this.panel.style.top = `${Math.round(y)}px`; + this.showMore(true); this.panel.style.visibility = ''; } + /** The more-below hint shows while rows remain under the list's bottom edge; instant sets it with no fade, for the first painted frame. */ + private showMore(instant = false): void { + const l = this.list; + const more = this.root().floor !== null && !this.panel.hidden && l.scrollHeight - l.clientHeight - l.scrollTop > 1; + if (instant) setClass(this.panel, 'no-fade', true); + setClass(this.panel, 'has-more', more); + if (instant) { void getComputedStyle(this.panel.lastElementChild ?? this.panel).opacity; setClass(this.panel, 'no-fade', false); } + } + private refresh(): void { for (const r of this.rows) { const cmd = this.commands.get(r.id); From 510f4ba24960304f1e7e6a75ffc1b9ba8556f955 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Mon, 30 Nov 2026 15:58:51 -0500 Subject: [PATCH 3/4] fix(menus): keep right-click menus under the bar with the cap and hint (0.47.0) ContextMenu clamped a menu's top to 8 px from the window top with only the stylesheet's cap, so a long right-click menu opened low in a short window was pushed up over the menu bar. Every ContextMenu opening now takes the bar's bottom edge plus 4 as its floor (8 px when the bar is hidden for the macOS menu bar), sets max-height to menuCap(floor) before measuring, and shows the same more-below hint. It still opens at the pointer as before; submenus take the same floor and cap. PopupMenu.openAt gets the same floor, cap and hint. Run: tsc --noEmit. --- frontend/HASHOUT_LOG.md | 27 +++++++++++++++++++++++++++ frontend/src/styles/shell.css | 16 ++++++++-------- frontend/src/ui/context-menu.ts | 31 ++++++++++++++++++++++++++++--- frontend/src/ui/menu.ts | 9 ++++++--- 4 files changed, 69 insertions(+), 14 deletions(-) diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md index f4d04bb..c268449 100644 --- a/frontend/HASHOUT_LOG.md +++ b/frontend/HASHOUT_LOG.md @@ -8,6 +8,7 @@ - [Stacking scale](#stacking-scale) - [Verification](#verification) - [Scripts](#scripts) +- [v0.47.0 · Right-click menus keep under the bar](#v0470--right-click-menus-keep-under-the-bar) - [v0.47.0 · The more-below hint](#v0470--the-more-below-hint) - [v0.47.0 · Bar menus stay under the bar](#v0470--bar-menus-stay-under-the-bar) - [Unreleased · Settings > About shows the third-party licence texts](#unreleased--settings--about-shows-the-third-party-licence-texts) @@ -78,6 +79,32 @@ - [v0.4.7 synced notes, map cards, inline edit commit](#v047-synced-notes-map-cards-inline-edit-commit) - [v0.4.6 GIF frames and document export](#v046-gif-frames-and-document-export) +## v0.47.0 · Right-click menus keep under the bar + +- refers-to: `src/ui/context-menu.ts` :: MORE, ContextMenu.floor, show, layer, place, showMore; `src/ui/menu.ts` :: barFloor, PopupMenu.openAt; `src/styles/shell.css` :: `.ctx-menu`, `.ctx-list`, `.ctx-more` + +FORM-MENU-OVERLAP-FIX 1.2.0, rule 5 and section 3b. `ContextMenu` is FormRef's own right-click renderer, apart from the bar's `PopupMenu`; every menu opened at a point goes through `show`: the board, item and connection menus (`app/gestures.ts`), tag chips and the tag cloud's More (`app/tag-cloud.ts`), the rating button (`app/rating.ts`) and saved searches (`app/saved-search.ts`). Its `place` clamped the top to `MARGIN` (8 px) from the window top, with only the stylesheet's `calc(100vh - var(--space-4))` as a cap, so a long menu opened low in a short window was pushed up over the bar. + +`show` takes the floor once per opening: the bottom of `.menubar` plus 4, or `MARGIN` when the bar does not show (the macOS system menu hides it with `display: none`, which `barFloor` reads as height 0). `place` sets `max-height: menuCap(floor)` on the still hidden layer before measuring, keeps the old pointer-corner placement (left of the point when the right has no room, submenus to the left of their row, shifted up when the bottom has no room) and only raises the top clamp from `MARGIN` to the floor. Submenus use the same floor and cap. Each layer is now a card holding `.ctx-list` and the `.ctx-more` pill, with the same CSS and timings as the bar menus and `showMore(layer, true)` before it is revealed. `ContextMenu` closes on resize, so the cap follows the window. The unused `PopupMenu.openAt` gets the same floor, cap and hint, so no point-anchored path is left with the old clamp. `tag-suggest` is a suggestion list under a text field, not a menu at a point, and is unchanged. Removed: + +```ts +for (const entry of entries) layer.append(this.row(entry, depth)); +layer.addEventListener('scroll', () => this.trim(depth + 1), { passive: true }); +``` + +```ts +layer.style.top = `${Math.max(MARGIN, top)}px`; +``` + +```ts +this.panel.style.maxHeight = `${Math.max(120, window.innerHeight - y - 4)}px`; +const top = Math.max(4, Math.min(fitsBelow ? y : y - h, window.innerHeight - h - 4)); +``` + +```css +.ctx-menu { overflow-y: auto; overscroll-behavior: contain; } +``` + ## v0.47.0 · The more-below hint - refers-to: `src/ui/menu.ts` :: PopupMenu.list, the constructor, setItems, items, showSub, openAt, openUnder, openBeside, showMore; `src/styles/shell.css` :: `.menu`, `--menu-more`, `.menu-list`, `.menu-more`, `.has-more`, `.no-fade` diff --git a/frontend/src/styles/shell.css b/frontend/src/styles/shell.css index 453287d..ee7ec4b 100644 --- a/frontend/src/styles/shell.css +++ b/frontend/src/styles/shell.css @@ -64,13 +64,13 @@ .menu-sep { height: 1px; margin: var(--space-1) var(--space-2); background: var(--border-color); } @property --menu-more { syntax: ''; inherits: false; initial-value: 0; } .menu:not([hidden]) { display: flex; flex-direction: column; } -.menu-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; --menu-more: 0; -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - min(88px, 40%)), rgb(0 0 0 / calc(1 - var(--menu-more))) calc(100% - min(22px, 10%))); mask-image: linear-gradient(to bottom, #000 calc(100% - min(88px, 40%)), rgb(0 0 0 / calc(1 - var(--menu-more))) calc(100% - min(22px, 10%))); transition: --menu-more 160ms ease-out; } -.menu-more { position: absolute; left: 50%; bottom: 6px; width: 56px; height: 12px; margin-left: -28px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--glass-border); border-radius: 999px; background: var(--glass-bg); color: var(--text-secondary); pointer-events: none; opacity: 0; transition: opacity 160ms ease-out; } -.menu-more svg { width: 12px; height: 8px; } -.menu.has-more > .menu-list { --menu-more: 1; scroll-padding-block-end: min(88px, 40%); transition-duration: 490ms; } -.menu.has-more > .menu-more { opacity: 1; transition-duration: 490ms; } -.menu.no-fade > .menu-list, .menu.no-fade > .menu-more { transition: none; } -@media (prefers-reduced-motion: reduce) { .menu-list, .menu-more { transition: none; } } +.menu-list, .ctx-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; --menu-more: 0; -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - min(88px, 40%)), rgb(0 0 0 / calc(1 - var(--menu-more))) calc(100% - min(22px, 10%))); mask-image: linear-gradient(to bottom, #000 calc(100% - min(88px, 40%)), rgb(0 0 0 / calc(1 - var(--menu-more))) calc(100% - min(22px, 10%))); transition: --menu-more 160ms ease-out; } +.menu-more, .ctx-more { position: absolute; left: 50%; bottom: 6px; width: 56px; height: 12px; margin-left: -28px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--glass-border); border-radius: 999px; background: var(--glass-bg); color: var(--text-secondary); pointer-events: none; opacity: 0; transition: opacity 160ms ease-out; } +.menu-more svg, .ctx-more svg { width: 12px; height: 8px; } +.menu.has-more > .menu-list, .ctx-menu.has-more > .ctx-list { --menu-more: 1; scroll-padding-block-end: min(88px, 40%); transition-duration: 490ms; } +.menu.has-more > .menu-more, .ctx-menu.has-more > .ctx-more { opacity: 1; transition-duration: 490ms; } +.menu.no-fade > .menu-list, .menu.no-fade > .menu-more, .ctx-menu.no-fade > .ctx-list, .ctx-menu.no-fade > .ctx-more { transition: none; } +@media (prefers-reduced-motion: reduce) { .menu-list, .menu-more, .ctx-list, .ctx-more { transition: none; } } .dock { position: relative; overflow: hidden; } .workspace > .editor { grid-column: 2; } @@ -97,7 +97,7 @@ :root:not([data-right-panel="agent"]) [data-panel="agent"], :root[data-right-panel="agent"] [data-panel="inspector"] { display: none; } -.ctx-menu { position: fixed; z-index: var(--z-dropdown); min-width: 236px; max-width: 320px; max-height: calc(100vh - var(--space-4)); overflow-y: auto; overscroll-behavior: contain; padding: var(--space-1); background: var(--bg-node); border: 1px solid var(--glass-border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); color: var(--text-primary); font-size: 12px; } +.ctx-menu { position: fixed; z-index: var(--z-dropdown); min-width: 236px; max-width: 320px; max-height: calc(100vh - var(--space-4)); display: flex; flex-direction: column; overflow: hidden; padding: var(--space-1); background: var(--bg-node); border: 1px solid var(--glass-border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); color: var(--text-primary); font-size: 12px; } .ctx-item { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: var(--space-2); width: 100%; height: 28px; padding: 0 var(--space-2); border: 0; border-radius: var(--radius-sm); background: none; color: inherit; font: inherit; text-align: left; cursor: default; } .ctx-item:hover:not(:disabled), .ctx-item:focus-visible { background: var(--accent-soft); color: var(--text-primary); outline: none; } .ctx-item:disabled { color: var(--text-muted); opacity: .55; } diff --git a/frontend/src/ui/context-menu.ts b/frontend/src/ui/context-menu.ts index 65018b7..cff9d8b 100644 --- a/frontend/src/ui/context-menu.ts +++ b/frontend/src/ui/context-menu.ts @@ -1,5 +1,6 @@ import { icon } from './icons'; import type { IconName } from './icons'; +import { barFloor, menuCap } from './menu'; export type MenuEntry = | { separator: true } @@ -9,10 +10,12 @@ export type MenuEntry = type ActionEntry = Extract; const MARGIN = 8; +const MORE = ''; export class ContextMenu { private readonly layers: HTMLElement[] = []; private restoreFocus: HTMLElement | null = null; + private floor = MARGIN; constructor(private readonly root: HTMLElement) { document.addEventListener('pointerdown', event => { @@ -28,6 +31,7 @@ export class ContextMenu { show(entries: MenuEntry[], x: number, y: number) { this.close(); + this.floor = Math.max(MARGIN, barFloor()); this.restoreFocus = document.activeElement as HTMLElement | null; const layer = this.layer(entries, 0); this.place(layer, x, y, null); @@ -45,9 +49,17 @@ export class ContextMenu { layer.className = 'ctx-menu'; layer.setAttribute('role', 'menu'); layer.style.visibility = 'hidden'; - for (const entry of entries) layer.append(this.row(entry, depth)); + const list = document.createElement('div'); + list.className = 'ctx-list'; + list.setAttribute('role', 'none'); + const more = document.createElement('div'); + more.className = 'ctx-more'; + more.setAttribute('aria-hidden', 'true'); + more.innerHTML = MORE; + for (const entry of entries) list.append(this.row(entry, depth)); + layer.append(list, more); layer.addEventListener('keydown', event => this.keys(event, layer, depth)); - layer.addEventListener('scroll', () => this.trim(depth + 1), { passive: true }); + list.addEventListener('scroll', () => { this.trim(depth + 1); this.showMore(layer); }, { passive: true }); this.root.append(layer); this.layers.push(layer); return layer; @@ -123,16 +135,29 @@ export class ContextMenu { } private place(layer: HTMLElement, x: number, y: number, anchor: DOMRect | null) { + layer.style.maxHeight = `${menuCap(this.floor)}px`; const { width, height } = layer.getBoundingClientRect(); let left = x; let top = y; if (left + width > window.innerWidth - MARGIN) left = anchor ? anchor.left - width + 2 : window.innerWidth - width - MARGIN; if (top + height > window.innerHeight - MARGIN) top = Math.max(MARGIN, window.innerHeight - height - MARGIN); layer.style.left = `${Math.max(MARGIN, left)}px`; - layer.style.top = `${Math.max(MARGIN, top)}px`; + layer.style.top = `${Math.max(this.floor, top)}px`; + this.showMore(layer, true); layer.style.visibility = ''; } + private showMore(layer: HTMLElement, instant = false) { + const list = layer.firstElementChild as HTMLElement; + const more = list.scrollHeight - list.clientHeight - list.scrollTop > 1; + if (instant) layer.classList.add('no-fade'); + if (layer.classList.contains('has-more') !== more) layer.classList.toggle('has-more', more); + if (instant) { + void getComputedStyle(layer.lastElementChild ?? layer).opacity; + layer.classList.remove('no-fade'); + } + } + private items(layer: HTMLElement): HTMLButtonElement[] { return [...layer.querySelectorAll('.ctx-item:not(:disabled)')]; } diff --git a/frontend/src/ui/menu.ts b/frontend/src/ui/menu.ts index 57cc6a0..2fcacaf 100644 --- a/frontend/src/ui/menu.ts +++ b/frontend/src/ui/menu.ts @@ -36,6 +36,7 @@ function setDisabled(node: HTMLButtonElement, on: boolean): void { if (node.disa const MENU_SHARE = 0.75, MENU_PAD = 4; export const menuCap = (top: number): number => Math.max(0, Math.min(Math.floor(window.innerHeight * MENU_SHARE), Math.floor(window.innerHeight - top - MENU_PAD))); +export const barFloor = (): number => { const r = document.querySelector('.menubar')?.getBoundingClientRect(); return r && r.height > 0 ? r.bottom + MENU_PAD : MENU_PAD; }; /** Items without the ids no command answers to; a submenu left empty goes too, and no separator is left leading, trailing or doubled. */ export function trimMenu(items: MenuItem[], commands: MenuCommands): MenuItem[] { @@ -154,19 +155,21 @@ export class PopupMenu { s?.close(); } - /** Refreshes labels, checks and enabled states, then shows the menu at x, y, kept within the window; a menu taller than the window scrolls. */ + /** Refreshes labels, checks and enabled states, then shows the menu at the point x, y, flipped when there is no room, never above the menu bar, with the bar menus' cap. */ openAt(x: number, y: number): void { + this.floor = barFloor(); this.refresh(); - this.panel.style.maxHeight = `${Math.max(120, window.innerHeight - y - 4)}px`; this.panel.style.visibility = 'hidden'; this.panel.hidden = false; + this.panel.style.maxHeight = `${menuCap(this.floor)}px`; this.list.scrollTop = 0; const { width: w, height: h } = this.panel.getBoundingClientRect(); const fitsRight = x + w <= window.innerWidth - 4, fitsBelow = y + h <= window.innerHeight - 4; const left = Math.max(4, Math.min(fitsRight ? x : x - w, window.innerWidth - w - 4)); - const top = Math.max(4, Math.min(fitsBelow ? y : y - h, window.innerHeight - h - 4)); + const top = Math.max(this.floor, Math.min(fitsBelow ? y : y - h, window.innerHeight - h - 4)); this.panel.style.left = `${Math.round(left)}px`; this.panel.style.top = `${Math.round(top)}px`; + this.showMore(true); this.panel.style.visibility = ''; } From c9636eb73b99383616ee1a522f0b2e35c6ae08b8 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Mon, 30 Nov 2026 16:04:47 -0500 Subject: [PATCH 4/4] chore(release): v0.47.0 Menus from the bar stay under it, right-click and other menus opened at a point never go above the bar's bottom edge, every menu takes a cap of three quarters of the window, and a cut-off menu shows a more-below hint. The Shell wiki page says so. Every version site moved from 0.46.2 to 0.47.0 by hand. --- .docs/wiki/Shell.md | 4 ++-- CHANGELOG.md | 9 +++++++++ README.md | 2 +- backend/app/core/config.py | 2 +- clipper/manifest.json | 2 +- frontend/index.html | 4 ++-- frontend/package-lock.json | 4 ++-- frontend/package.json | 2 +- native/formref-core/Cargo.lock | 2 +- native/formref-core/Cargo.toml | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 13 files changed, 24 insertions(+), 15 deletions(-) diff --git a/.docs/wiki/Shell.md b/.docs/wiki/Shell.md index dcd44c2..ccea22b 100644 --- a/.docs/wiki/Shell.md +++ b/.docs/wiki/Shell.md @@ -8,7 +8,7 @@ Every action lives once in `frontend/src/app/commands.ts` with its label, icon a ## Menubar -File, Edit, View, Insert, Images, Organize, Window and Help sit in the top bar on Windows and Linux and in the macOS menu bar on a Mac (View, Menus in Window moves them into the window there). The tree is a list of command ids in `frontend/src/app/menus.ts`; labels, keys and enabled states come from the command table. F10 opens the first menu, Alt with a menu's first letter opens that menu unless the combination is a shortcut, and a menu taller than the window scrolls. In a narrow window the menubar scrolls sideways. +File, Edit, View, Insert, Images, Organize, Window and Help sit in the top bar on Windows and Linux and in the macOS menu bar on a Mac (View, Menus in Window moves them into the window there). The tree is a list of command ids in `frontend/src/app/menus.ts`; labels, keys and enabled states come from the command table. F10 opens the first menu, Alt with a menu's first letter opens that menu unless the combination is a shortcut. A menu opens just under its name and never covers the menubar; it is at most three quarters of the window tall and the rest scrolls, with a fade and a small down arrow at its bottom while rows remain below. Submenus keep under the menubar too. In a narrow window the menubar scrolls sideways. ## Home @@ -20,7 +20,7 @@ Preferences (Ctrl+,) is one window: a rail of categories on the left (General, C ## Right-click menu -Right-click the canvas or a selection for iStack's menu in iStack's order: File, Edit, Canvas, Organize, Images, Layer, Lock, Add Note, Draw Mode, Slideshow, Delete, then FormRef's Insert and Ask Agent. Menus open in the overlay layer and close on Escape or an outside click. +Right-click the canvas or a selection for iStack's menu in iStack's order: File, Edit, Canvas, Organize, Images, Layer, Lock, Add Note, Draw Mode, Slideshow, Delete, then FormRef's Insert and Ask Agent. Menus open in the overlay layer at the pointer and close on Escape or an outside click. They never go above the menubar's bottom edge, take the same three-quarter height limit as the menubar's menus, and show the same more-below hint. ## Board tabs diff --git a/CHANGELOG.md b/CHANGELOG.md index e9d64ae..2ec84fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # FormRef changelog +## v0.47.0 · 2026-11-30 + +Menus never cover the menu bar, and a long menu shows that it has more rows below. + +- A menu from the menu bar opens just under its name and stays there. Before, a long menu such as Edit or View in a short window was moved up over the menu bar. It is now at most three quarters of the window tall, and the rest scrolls. +- Submenus open beside their row as before, but never above the menu bar, with the same height limit. +- Right-click menus, and the menus of the tag cloud, the rating button and saved searches, still open where you click, but no longer go over the menu bar and take the same height limit. Before, a long one opened low in a short window was pushed up over the bar. +- A menu with more rows than fit fades out at its bottom and shows a small down arrow there until you reach the last row. A menu that fits looks as before. With reduced motion turned on, it shows and hides without fading. + ## v0.46.2 · 2026-11-29 Google Drive sign-in finishes, Codex and Cursor work from the Agent panel in the installed app and on Windows, and one data folder is served by one FormRef at a time. diff --git a/README.md b/README.md index 34df90d..0031a91 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@

- version 0.46.2 + version 0.47.0 Rust engine TypeScript and FastAPI macOS, Windows, Linux diff --git a/backend/app/core/config.py b/backend/app/core/config.py index 0efe7dd..b24c4e2 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -4,7 +4,7 @@ from pathlib import Path ROOT = Path(getattr(sys, "_MEIPASS", "")).resolve() if getattr(sys, "frozen", False) else Path(__file__).resolve().parents[3] -VERSION = "0.46.2" +VERSION = "0.47.0" NOTICES_NAME = "THIRD-PARTY-NOTICES.txt" diff --git a/clipper/manifest.json b/clipper/manifest.json index 26dbf27..9db2878 100644 --- a/clipper/manifest.json +++ b/clipper/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "FormRef Clipper", - "version": "0.46.2", + "version": "0.47.0", "description": "Save images, selected text, links and pages to the FormRef board running on your computer.", "author": "nodemode-ai", "icons": { "16": "icons/icon-16.png", "32": "icons/icon-32.png", "48": "icons/icon-48.png", "128": "icons/icon-128.png" }, diff --git a/frontend/index.html b/frontend/index.html index f5c2f58..779b049 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -129,7 +129,7 @@

@@ -715,7 +715,7 @@

NODEMODE HOST

ABOUT

-

FormRef v0.46.2

+

FormRef v0.47.0

by nodemode.ai

Apache License 2.0. Third-party notices are in NOTICE.md.

Third-party licence texts
diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 9585849..7746496 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "formref-frontend", - "version": "0.46.2", + "version": "0.47.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "formref-frontend", - "version": "0.46.2", + "version": "0.47.0", "dependencies": { "@xterm/addon-fit": "0.11.0", "@xterm/xterm": "6.0.0", diff --git a/frontend/package.json b/frontend/package.json index 5f7f006..b3d71b8 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "formref-frontend", - "version": "0.46.2", + "version": "0.47.0", "private": true, "type": "module", "scripts": { diff --git a/native/formref-core/Cargo.lock b/native/formref-core/Cargo.lock index 21f9e1c..3fd3be8 100644 --- a/native/formref-core/Cargo.lock +++ b/native/formref-core/Cargo.lock @@ -4,7 +4,7 @@ version = 4 [[package]] name = "formref-core" -version = "0.46.2" +version = "0.47.0" dependencies = [ "serde", "serde_json", diff --git a/native/formref-core/Cargo.toml b/native/formref-core/Cargo.toml index 9f0c7ed..c8b79e5 100644 --- a/native/formref-core/Cargo.toml +++ b/native/formref-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "formref-core" -version = "0.46.2" +version = "0.47.0" edition = "2021" rust-version = "1.82" authors = ["nodemode-ai "] diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index aa85b89..f3a19ac 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -839,7 +839,7 @@ dependencies = [ [[package]] name = "formref-desktop" -version = "0.46.2" +version = "0.47.0" dependencies = [ "objc2", "objc2-app-kit", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 2430c83..797a924 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "formref-desktop" -version = "0.46.2" +version = "0.47.0" description = "FormRef desktop shell" authors = ["nodemode-ai "] edition = "2021" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 662b752..9741573 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "FormRef", - "version": "0.46.2", + "version": "0.47.0", "identifier": "ai.nodemode.formref", "build": { "beforeDevCommand": { "cwd": "../frontend", "script": "npm run dev", "wait": false },