Diagnostics for focus and layering (--diag / WAYBETTER_DIAG=1): one timestamped line per event in the app's log folder

For the macOS reports (the menu never shows and the window goes inactive on a click; the find field gets no keyboard): off unless the app is started with `--diag` or WAYBETTER_DIAG=1. Then native code and the shell append to `diag.log` in the app's log folder (truncated at launch): menu open requests and every close with its reason, overlay counts, raise/lower and `shell_raise` results, native `shell_focus` calls and their result, the shell document's focus/blur/visibility, and where the find bar's focus is right after it opens and 300 ms later. A line is an event and a few words in plain ASCII (capped); never a URL, a query or page text. `diag_get` / `diag_log` are shell-only (in commands::SHELL and the template's list).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
CRTkafa 2026-10-01 04:11:53 +07:00
parent 7f9e172196
commit 43fc8a15f5
8 changed files with 147 additions and 69 deletions

View file

@ -31,6 +31,7 @@ import { NewTabPage } from './NewTabPage.tsx';
import type { PaletteAction, PaletteContext } from './paletteModel.ts';
import { PaneThemeHost, openPaneTheme } from './PaneTheme.tsx';
import { focusedCommands, installPluginCommands, notePanelActive, refreshPluginNames, runPluginCommand } from './pluginCommandStore.ts';
import { initDiag } from './diag.ts';
import { installSafeMode } from './safeStore.ts';
import { hasFeature, site } from './site.ts';
import {
@ -609,6 +610,8 @@ export default function Shell() {
// The site's own settings and events (e.g. X's Twitter/X wording).
useEffect(() => site().start?.(), []);
// Focus and layering diagnostics, when the app was started with them (`--diag`).
useEffect(() => { void initDiag(); }, []);
useEffect(() => {
const unlisten = [