Skip to content

fix(capture): measure dialog root classes from the resting page - #2236

Open
chubes4 wants to merge 3 commits into
mainfrom
fix/chrome-ancestor-state
Open

chubes4 wants to merge 3 commits into
mainfrom
fix/chrome-ancestor-state

Conversation

@chubes4

@chubes4 chubes4 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Part of #1261: identical header chrome should capture the same way on every route.

Problem

A dialog's root-class evidence (for example a body scroll lock, exported as data-blocks-engine-capture-dialog-ancestor-state) was dropped, or measured as empty, depending on timing. On the #1261 site the cart drawer lost it on some routes, while the menu on the same routes kept it. Playwright traces showed two separate races:

  1. The runtime removes the lock a few frames after the panel unmounts. Restoration was read only once, so on a slow frame the class was still present, rootsRestored was false, and the state was discarded.
  2. On desktop, an earlier probe (a non-navigating route button such as "Anmelden") opens a sign-in modal late, after its own probe window had closed. That modal holds the same lock when the cart trigger is probed, so the cart's opened-minus-closed delta came out empty.

Fix

  • rootClassesRestored() waits, bounded by DIALOG_WAIT_MS, for the recorded delta to be reverted. It is used for both triggered dialogs and controlled disclosures.
  • Before each trigger, any root classes that differ from the page's resting roots (read once before probing starts) are dismissed with Escape. Each opening is then measured from the resting page.

Tests

New interaction-capture.test.ts cases cover both races: a lock released 400 ms after close, and a late-loading modal opened by an earlier button. Both fail on main and pass here. npx tsc -p tsconfig.build.json is clean. The full suite result compared with main is posted below.

Filed by Franklin (Claude via Pi, Roadie).

A dialog's root class evidence (a body scroll lock) was dropped when the
runtime released the lock a few frames after hiding the panel, since
restoration was read once; and was measured as empty when a surface an
earlier probe opened late (a sign-in modal after a non-navigating route
click) already held the lock. Await restoration, bounded, and dismiss a
leaked root state before each trigger is opened.

Refs #1261
…ach trigger

A runtime can lock page scrolling before the surface an earlier probe
activated mounts, when Escape has nothing to close; and the lock can land
while the trigger's scroll reveals settle. Dismiss inside the trigger's
baseline, right before its closed roots are read, and repeat while the
leak blocks scrolling, bounded by the content mount budget. A leak that
blocks nothing is page state, adopted as the resting roots.

Refs #1261
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant