* feat(menu): AccountControl, a panel that stays on screen, remote session read
A consumer gets, from the browser-safe "." entry:
- AccountControl: one header control for loading (an inert box the
trigger's size), signed out (one 44px "Sign in" link) and signed in
(AccountMenu, unchanged), plus accountSignInHtml({ href, label }), the
same signed-out markup byte for byte for a static page.
- fetchAccountSummary(url, { signal?, fetch?, timeoutMs? }): a
credentialed, no-store GET of a session held on another origin that
resolves null on any failure and never rejects, including an injected
fetch that returns something that is not a Response. timeoutMs (default
8000; 0, negative or Infinity turns it off) bounds the whole read, body
included, combined with the caller's signal (AbortSignal.any where
available, by hand otherwise), so a stalled server cannot leave a header
loading for ever and the header fails closed to "Sign in".
- returnPath, the same-origin path guard, no longer only behind the
server-only ./orangecat entry.
Fix: the open panel ran off the screen when the trigger was not last in its
row (-112px at 390 in Bitbaum's header). The menu now measures the open
panel and moves it inside only when it crosses an edge; a last trigger's
panel is unchanged. It is measured again while open on a window resize and,
without one, when the panel or its header row (nearest flex or grid
ancestor) or a control in that row changes size, or a control is added to
or removed from the row (ResizeObserver and MutationObserver, feature
detected, disconnected on close and unmount).
Checked by pnpm run verify: browser checks at 320 and 390, light and dark,
on four demo rows (a 44px control before or after the trigger, both
aligns), which failed on the old stylesheet; with the menu open, a 44px
control added after the trigger, and the existing one widened, without a
window resize (left -47px at 320 before); render tests comparing
AccountControl with accountSignInHtml and AccountMenu, escaping hostile
input; unit tests for fetchAccountSummary with an injected fetch (non-
Response values, a fetch and a body that never settle, the 8000ms default
under mock timers, the caller's abort with a timeout armed, the fallback
without AbortSignal.any, Infinity) and for returnPath from ".". The browser
check honours CHROMIUM_PATH. dist/orangecat.d.ts only shows a union
reordered by the compiler, not a source change.
Claude-Session: https://claude.ai/code/session_019MDtmsSWTTpVpe4wh3v1sb
* fix(menu): the panel is moved in layout, so nothing scrolls sideways
The pull request's own browser check failed in CI and passed locally:
with the panel open in the two `align="start"` demo rows the page
scrolled sideways by 186px and 242px, at 320 and 390 wide, while the
panel itself measured inside the screen. CI runs Chromium 156; the local
run was Chromium 153. The panel was moved back on screen with
`translate`, and the page still counted the place it had come from.
What a consumer gets: the panel is moved on the edge it is pinned by, in
layout (`inset-inline-start` or `inset-inline-end` take `--acct-shift`).
A box laid out inside the screen cannot make the page scroll in any
browser. The move follows the text direction: in a right-to-left page
the pinned edge is the other one, and the offset changes sign with it.
How it is checked: test/browser.mjs opens the four demo rows again with
the page set right to left, at 320 and 390px, light and dark, and asserts
the panel is inside the viewport and nothing scrolls sideways. The
existing left-to-right checks are unchanged. `pnpm run verify` passes on
Chromium 153; CI decides for 156.
Claude-Session: https://claude.ai/code/session_019MDtmsSWTTpVpe4wh3v1sb
---------
Co-authored-by: Claude <noreply@anthropic.com>