Startup cover never outlasts a page that does not say it painted; menu clicks ask nothing native; mode cards show their picture

Release blocker (macOS 1.0.0: both panes stayed on the shell's loading shape). After `shell_ready` the startup cover waited, with no limit, for every visible site tab to report that it painted. A page whose report never comes (its paint check is frame-driven and gives up after 10 s, and an engine may hold a hidden window's frames back) kept the shell raised over the panes, showing the skeleton, for good. The wait is now bounded (8 s after the window is shown); the page then shows as it is.

The app menu asked for the keyboard natively (`shell_focus`) on every open. It now does so only when the shell does not have it (keys pressed in a tab); a click on the shell already gave it the keyboard.

The mode cards' default picture was shrunk to 16px by the shell's base glyph rule ("a few dots"); it keeps its size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
CRTkafa 2026-10-01 03:40:02 +07:00
parent 2e3babd2f5
commit 06e830b132
3 changed files with 12 additions and 2 deletions

View file

@ -115,8 +115,9 @@ export function AppMenu() {
} }
const active = document.activeElement as HTMLElement | null; const active = document.activeElement as HTMLElement | null;
before.current = active && active !== document.body && document.hasFocus() ? active : null; before.current = active && active !== document.body && document.hasFocus() ? active : null;
// Keys pressed in a tab open the menu: the shell takes the keyboard. // Keys pressed in a tab open the menu: the shell takes the keyboard. A click on the shell already
invoke('shell_focus').catch(() => {}); // gave it the keyboard, so nothing native is asked for then.
if (!document.hasFocus()) invoke('shell_focus').catch(() => {});
setAsking(null); setError(''); setAsking(null); setError('');
setPath(request.submenu ? [request.submenu] : []); setPath(request.submenu ? [request.submenu] : []);
focusNext.current = request.submenu ? { level: 1, edge: 'first' } : { level: 0, edge: request.keyboard ? 'first' : 'menu' }; focusNext.current = request.submenu ? { level: 1, edge: 'first' } : { level: 0, edge: request.keyboard ? 'first' : 'menu' };

View file

@ -48,6 +48,9 @@ import './shell.css';
type Placement = { referencePanel: string; direction: 'within' | 'right' | 'below' }; type Placement = { referencePanel: string; direction: 'within' | 'right' | 'below' };
/** How long the startup cover waits, once the window is shown, for the visible site tabs to say they painted. */
export const STARTUP_CONTENT_WAIT = 8000;
/** A development build (createShell's `dev`): the shell keeps the devtools shortcut. */ /** A development build (createShell's `dev`): the shell keeps the devtools shortcut. */
let devBuild = false; let devBuild = false;
export function setDevBuild(value: boolean) { export function setDevBuild(value: boolean) {
@ -925,11 +928,15 @@ export default function Shell() {
const check = () => { if (done()) finish(); }; const check = () => { if (done()) finish(); };
const finish = () => { const finish = () => {
clearInterval(poll); clearInterval(poll);
clearTimeout(limit);
window.removeEventListener('bt-tab-startup-state', check); window.removeEventListener('bt-tab-startup-state', check);
resolve(); resolve();
}; };
// Dockview closes and deck layout changes do not always emit tab-state. // Dockview closes and deck layout changes do not always emit tab-state.
const poll = setInterval(check, 200); const poll = setInterval(check, 200);
// Never longer than this: a page that never says it painted (its script failed, the
// engine held its frames back) shows as it is rather than behind a cover for good.
const limit = setTimeout(finish, STARTUP_CONTENT_WAIT);
window.addEventListener('bt-tab-startup-state', check); window.addEventListener('bt-tab-startup-state', check);
}); });
// The X DOM signal can precede its separate native WebView surface by a frame. // The X DOM signal can precede its separate native WebView surface by a frame.

View file

@ -53,5 +53,7 @@
.wbm-card > span:last-child { color: var(--c-muted); font-size: 12.5px; line-height: 1.5; } .wbm-card > span:last-child { color: var(--c-muted); font-size: 12.5px; line-height: 1.5; }
.wbm-art { display: grid; place-items: center; height: 72px; border-radius: 10px; background: var(--c-field); color: var(--c-muted); } .wbm-art { display: grid; place-items: center; height: 72px; border-radius: 10px; background: var(--c-field); color: var(--c-muted); }
.wbm-card.is-on .wbm-art { color: var(--c-accent); } .wbm-card.is-on .wbm-art { color: var(--c-accent); }
/* The shell's base glyph rule (16px icons) must not shrink a card's picture to a few dots. */
.wbm-art svg { width: 96px; height: 40px; }
.wbm-note { color: var(--c-text-2, var(--c-muted)); } .wbm-note { color: var(--c-text-2, var(--c-muted)); }
.wbm-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; } .wbm-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }