Skip to content

fix(apps): Notepad opens persisted docs; start-menu focus contract pinned (#32) - #38

Merged
Xuepoo merged 4 commits into
mainfrom
carryctx/web-0035-defects
Aug 25, 2026
Merged

Xuepoo merged 4 commits into
mainfrom
carryctx/web-0035-defects

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

PR body

Closes #32. Fixes #36 (theme-switch focus stranding).

  • Notepad stale-open after reload (E2E-verified cross-engine): create() seeded WELCOME_TEXT and never read the VFS; opening now restores the persisted document (guard baseline committed, typed-during-flight stand-down, read errors stay on the Reload path). Red-checked smoke test included.
  • Start-menu dismissal focus contract pinned by tests (Escape / click-outside restore opener); dead start-menu-keys.ts shim removed with its own commit.
  • Theme-switch focus stranding (Theme switch while the start menu is open strands DOM focus on body #36): closeStartMenu re-validates the captured opener and defers to the rebuilt bar's Start-tile mirror when disconnected (mirrors project on the next syncA11y pass, verified against engine dist). Regression test red-checked.

Review round complete: commit/message mismatch resolved via rebase; F2/F3 findings addressed or documented.

Gates: 187 pass / 0 fail (rebased on 91ea42c) · tsc clean · oxlint clean · oxfmt repo-wide · build OK.

Xuepoo added 4 commits August 25, 2026 15:50
The open path never read the VFS: create() seeded the editor with the
welcome copy and only the click-driven reloadFromVfs() ever called
vfs.read. After a full page reload StorageVfs had already replayed the
snapshot (Files listed the document), yet a freshly opened Notes window
rendered seed text until the user clicked Reload — confirmed E2E
cross-engine on the previous deploy (PX-0099/PX-0108).

Opening now restores persisted content immediately when the
deterministic target document (/notes/note-N.txt) already exists. The
restore stands down if the user typed while stat/read were in flight,
so async loading can never clobber live edits; read errors keep the
seed text and stay on the Reload path's status reporting.

Regression test reproduces the defect through the real boot: write the
next note's document into the restored VFS, shell.open('notes'), assert
the editor value (red-checked against the unfixed tree). (#32)
…s shim

Re-derived WEB-0035 defect B against the post-rewrite architecture: the
opener-focus restore survived PR #31 reimplemented inline in main.ts
(closeStartMenu captures the opener at open and hands focus back when
dismissal leaves it stranded on body). Escape, toggle and click-outside
closes all run through that path.

Add the missing outside-click close-path regression to the smoke suite,
following the established post-prune focus pattern (overlay mirrors are
not reliably projected under happy-dom).

Remove src/desktop/start-menu-keys.ts: the pre-rewrite keyboard shim
wrapped shell.toggleStartMenu for the engine StartMenu entity and owned
the old restore logic; PR #31 stopped installing it (was main.ts:324)
leaving zero references while its header still claimed ownership of
focus restoration — exactly the drift this module list warns about.
roving-focus.ts stays: pure tested util, not tied to the dead wiring. (#32)
applyTheme rebuilds the WebOSTaskbar before closeStartMenu runs, so an
opener captured while the menu was open is already disconnected at
restore time and focus() on the detached node silently no-ops — Escape,
outside click and launch dismissal all strand DOM focus on body after a
theme switch (review F3, PR #31 leftover).

Re-validate the captured opener at restore time: keep the immediate
focus() while it is still connected, otherwise defer focus to the live
bar's Start tile mirror one sync pass out — rebuilt mirrors are
projected by the next a11y sync pass, not on scene.add. The deferred
restore yields if anything else took focus meanwhile, matching the
immediate path's contract.

WebOSTaskbar gains a startButton accessor for the fallback target. The
regression test drives applyTheme with a captured opener and pins focus
on the rebuilt bar's Start mirror; verified red without the fix.

webos#36
@Xuepoo
Xuepoo merged commit c56cbbe into main Aug 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant