|
12 | 12 | (function () { |
13 | 13 | 'use strict'; |
14 | 14 |
|
| 15 | + // `join` controls the visual separator between kbd chips for |
| 16 | + // multi-key shortcuts: '+' for a chord (press together), 'then' for |
| 17 | + // a sequence (press in order), '/' for "either of these keys". |
| 18 | + // Single-key rows leave `join` unset and render no separator. |
15 | 19 | const SHORTCUTS = [ |
16 | 20 | { keys: ['?'], label: 'Show this help' }, |
17 | | - { keys: ['Cmd/Ctrl', 'K'], label: 'Open command palette' }, |
18 | | - { keys: ['g', 'b'], label: 'Switch box (palette)' }, |
| 21 | + { keys: ['Cmd/Ctrl', 'K'], label: 'Open command palette', join: '+' }, |
| 22 | + { keys: ['g', 'b'], label: 'Switch box (palette)', join: 'then' }, |
19 | 23 | { keys: ['/'], label: 'Focus the page search input' }, |
20 | 24 | { keys: ['Esc'], label: 'Close dialog · or blur input · or go back' }, |
21 | | - { keys: ['↑', '↓'], label: 'Navigate dialog items' }, |
| 25 | + { keys: ['↑', '↓'], label: 'Navigate dialog items', join: '/' }, |
22 | 26 | { keys: ['↵'], label: 'Select highlighted item' }, |
23 | 27 | { keys: ['Tab'], label: 'Cycle focus within a dialog' }, |
24 | 28 | { keys: ['Ctrl+↵'], label: 'In palette: switch box but keep palette open' }, |
|
42 | 46 | const keys = document.createElement('span'); |
43 | 47 | keys.className = 'flex items-center gap-1'; |
44 | 48 | s.keys.forEach(function (k, i) { |
45 | | - if (i > 0 && (s.keys.length > 1)) { |
46 | | - // Inter-key separator: "+" for chord, " then " for sequence. |
| 49 | + if (i > 0 && s.join) { |
47 | 50 | const sep = document.createElement('span'); |
48 | | - sep.className = 'text-[10px] text-white/40 px-0.5'; |
49 | | - sep.textContent = (k === '↓' || k === '↑' || /^[A-Z]$/.test(s.keys[0])) ? ' ' : ' '; |
| 51 | + sep.className = 'text-[10px] text-white/50 px-0.5'; |
| 52 | + sep.textContent = s.join; |
50 | 53 | keys.appendChild(sep); |
51 | 54 | } |
52 | 55 | const kbd = document.createElement('kbd'); |
|
130 | 133 | const el = document.getElementById(ids[i]); |
131 | 134 | if (el && !el.classList.contains('hidden')) return true; |
132 | 135 | } |
| 136 | + // Narrow-viewport Filters sheet popped out under the header |
| 137 | + // (`.filters-open` on #header-page-content). Treat as an |
| 138 | + // overlay so pressing Esc to close it doesn't fall through |
| 139 | + // to history.back(). |
| 140 | + const headerContent = document.getElementById('header-page-content'); |
| 141 | + if (headerContent && headerContent.classList.contains('filters-open')) { |
| 142 | + return true; |
| 143 | + } |
| 144 | + // Right-click "Reorder gears" context menu on the sidebar. |
| 145 | + const ctxMenu = document.getElementById('sidebar-context-menu'); |
| 146 | + if (ctxMenu && !ctxMenu.classList.contains('hidden')) { |
| 147 | + return true; |
| 148 | + } |
133 | 149 | return false; |
134 | 150 | } |
135 | 151 | function isBlurrableTarget(el) { |
|
0 commit comments