From d2a1d14eacd1c6e7ffa0c5c4f0b04d0216122b14 Mon Sep 17 00:00:00 2001 From: Codeman maintainer Date: Thu, 8 Oct 2026 17:33:26 +0200 Subject: [PATCH] feat(tiles): a hover card on the Tiles button says what a right-click does MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Owner feedback 1: "give me the hover info to right click over the tile button to adjust it". The only hint was the native title, which the browser shows late, small and unstyled. The Tiles button now has its own hover card, under it in the count menu's panel style: - "Tiles · N" with the remembered count (live: a pick in the menu changes it while the card is up), "Click: open the grid" ("close the grid" while it is open), "Right-click: choose 2, 4 or 6 tiles", and when the count does not fit the window what opens instead ("This window fits 4 tiles: a click opens 4"; open, what fits). Shown from the keyboard it adds "Shift+F10: the same menu from the keyboard". - Shows 300 ms after a pointer that hovers rests on the button, or after a keyboard focus (:focus-visible); never for a touch pointer or a device that cannot hover (plus a CSS @media (hover: none) backstop), never on a hidden button, never while the count menu is open. A short fade on opacity and transform, none under reduced motion; it takes no pointer. - Hides on pointer leave, blur, Escape, a scroll and a resize, and on a press, a click or a right-click on the button (capture phase, so it is gone before the menu or the grid opens, and it stays gone while the pointer rests there). openTileCountMenu hides it too, and the focus the menu's Escape puts back on the button brings no card back. - It replaces the button's native title (two tooltips never stack); the aria-label stays and aria-describedby points at the card, which always exists and is kept current, its keyboard line included while hidden, so screen readers hear the same text without a hover. Text is diffed against the last English, as the rest of the grid chrome, so the zh-CN translator is not fought on every refresh. - zh-CN for every line (平铺 · N, 单击, 右键单击, Shift+F10, the fits note); no other header button changes (its styles are .tile-hint only). Tests: tile-grid-hint.test.ts (install and aria wiring, the delay, each show and hide path, content per state and count, the menu rule, the translator, the CSS); the count menu and i18n tests read the accessible name instead of the removed title, and the i18n harvest covers the card (F10 joins the key names that stay Latin). The vm harness gains removeAttribute. Co-Authored-By: Claude Opus 5.5 (1M context) --- src/web/public/i18n.js | 10 + src/web/public/index.html | 2 +- src/web/public/styles.css | 83 +++++++ src/web/public/tile-grid.js | 203 ++++++++++++++++- test/mocks/tile-grid-vm.ts | 4 + test/tile-grid-count-menu.test.ts | 9 +- test/tile-grid-hint.test.ts | 357 ++++++++++++++++++++++++++++++ test/tile-grid-i18n.test.ts | 35 ++- 8 files changed, 687 insertions(+), 16 deletions(-) create mode 100644 test/tile-grid-hint.test.ts diff --git a/src/web/public/i18n.js b/src/web/public/i18n.js index ff3ad3f0..e0be0d4d 100644 --- a/src/web/public/i18n.js +++ b/src/web/public/i18n.js @@ -107,6 +107,11 @@ '平铺:并排显示多个会话(右键单击可选择窗格数量)', 'Tiles: back to a single session (right-click for how many tiles)': '平铺:返回单个会话(右键单击可选择窗格数量)', 'How many tiles': '窗格数量', + // The Tiles button's hover card (the count and the fits note are patterns). + 'Click: open the grid': '单击:打开平铺网格', + 'Click: close the grid': '单击:关闭平铺网格', + 'Right-click: choose 2, 4 or 6 tiles': '右键单击:选择 2、4 或 6 个窗格', + 'Shift+F10: the same menu from the keyboard': 'Shift+F10:用键盘打开同一菜单', 'Split: unavailable while tiles are open': '分屏:平铺打开时不可用', 'Toggle Tile Grid': '切换平铺网格', 'Focus Tile Left': '聚焦左侧窗格', @@ -1057,6 +1062,11 @@ ], // Tile grid: counts, exit codes and durations pass through. [/^(\d+) tiles$/, (_m, n) => `${n} 个窗格`], + [/^Tiles \u00B7 (\d+)$/, (_m, n) => `平铺 · ${n}`], + [ + /^This window fits (\d+) tiles?: a click opens (\d+)$/, + (_m, n, m) => `此窗口可容纳 ${n} 个窗格:单击将打开 ${m} 个`, + ], [/^This window fits (\d+) tiles?$/, (_m, n) => `此窗口可容纳 ${n} 个窗格`], [/^The grid holds at most (\d+) tiles$/, (_m, n) => `平铺网格最多容纳 ${n} 个窗格`], [ diff --git a/src/web/public/index.html b/src/web/public/index.html index 910f9316..e49740bb 100644 --- a/src/web/public/index.html +++ b/src/web/public/index.html @@ -192,7 +192,7 @@ - +
—