Bar toast's clock starts when queued, not when painted: Undo is gone before a slow screen shows it (composer-tasks.spec:115 fails 10/10 on WebKit) #948

Closed
opened 2026-11-04 23:48:54 +00:00 by kayg · 2 comments
Owner

Found while gating #946 (a11y High fixes): apps/web/e2e/composer-tasks.spec.ts:115 "a line about a person makes a contact card (contacts.create), Undo deletes it" fails 10/10 on WebKit (webkit-1440) on origin/dev (--repeat-each=10, same binary), and passes on Chromium.

Symptom

The palette shows "Contact added · Undo", the test hovers it to hold it ("Hold the normal toast clock", as the sibling task test does with the bar toast), waits for the contact to be searchable, then clicks Undo: the Undo button is gone. The page snapshot at the timeout shows the contact card was created, the palette is open and idle, and no role=status notice is left.

Root cause

The row in the palette (ComposerBody.svelte, <p class="notice" role="status">, fed by maker.svelte.ts say()) is cleared by a fixed 7 s timer (noticeTimer). Unlike the bar toast (toastBar.hovered pauses its clock), the palette row ignores the pointer: hovering or focusing it does not hold it. When anything slower than 7 s happens (WebKit indexing a new contact card here, a slow person reading it on a phone), Undo disappears under the pointer. Undo is the safety net for an action that has already been written, so it must not vanish while it is being pointed at or focused.

Fix (separate small PR)

Hold the row's clock while the pointer is over it or focus is inside it, and restart the full time when it leaves. No change to the test.

Found while gating #946 (a11y High fixes): `apps/web/e2e/composer-tasks.spec.ts:115` "a line about a person makes a contact card (contacts.create), Undo deletes it" fails **10/10 on WebKit (webkit-1440) on origin/dev** (`--repeat-each=10`, same binary), and passes on Chromium. ## Symptom The palette shows "Contact added · Undo", the test hovers it to hold it ("Hold the normal toast clock", as the sibling task test does with the bar toast), waits for the contact to be searchable, then clicks Undo: the Undo button is gone. The page snapshot at the timeout shows the contact card was created, the palette is open and idle, and **no `role=status` notice is left**. ## Root cause The row in the palette (`ComposerBody.svelte`, `<p class="notice" role="status">`, fed by `maker.svelte.ts say()`) is cleared by a fixed 7 s timer (`noticeTimer`). Unlike the bar toast (`toastBar.hovered` pauses its clock), the palette row ignores the pointer: hovering or focusing it does not hold it. When anything slower than 7 s happens (WebKit indexing a new contact card here, a slow person reading it on a phone), Undo disappears under the pointer. Undo is the safety net for an action that has already been written, so it must not vanish while it is being pointed at or focused. ## Fix (separate small PR) Hold the row's clock while the pointer is over it or focus is inside it, and restart the full time when it leaves. No change to the test.
Author
Owner

Corrected root cause (supersedes the 7 s palette-row theory above)

On desktop "Contact added · Undo" is the bar toast, not the palette row (the row is the phone's). Probing the real test flow on WebKit (rAF samples, DEBUG=pw:api):

  • WebKit draws in software, so on a busy host the page produces about one frame a second. The toast's entry morph (the capsule growing from 102 to 183 px wide and sliding left) then takes ~4 s of wall-clock; Playwright's hover() waits for "visible and stable" (+4 s in the log, 8–10 s when the host is loaded).
  • The toast's clock (inbar.svelte.ts tick()) starts when the toast is queued, before the view exists or has painted anything. By the time hover can land (and hold the clock), the toast has used up most of its time or is gone. Snapshot at the timeout: contact created, palette idle, no status.
  • The sibling task test passes because its toast is not behind the same slow entry.

This also happens to real people on slow screens: the Undo for an action that has already been written can run out before it has been painted.

Fix (PR for this issue)

The toast's view sets toastBar.settling on mount and clears it two frames later; the clock stands still while it is set. So a toast's time is counted from when it has been painted ("for duration ms from when it's visible", as the presenter's doc already says). Unit test added in inbar.test.ts; the e2e spec is unchanged.

## Corrected root cause (supersedes the 7 s palette-row theory above) On desktop "Contact added · Undo" is the **bar toast**, not the palette row (the row is the phone's). Probing the real test flow on WebKit (rAF samples, `DEBUG=pw:api`): - WebKit draws in software, so on a busy host the page produces about **one frame a second**. The toast's entry morph (the capsule growing from 102 to 183 px wide and sliding left) then takes ~4 s of wall-clock; Playwright's `hover()` waits for "visible and stable" (+4 s in the log, 8–10 s when the host is loaded). - The toast's clock (`inbar.svelte.ts tick()`) starts when the toast is **queued**, before the view exists or has painted anything. By the time hover can land (and hold the clock), the toast has used up most of its time or is gone. Snapshot at the timeout: contact created, palette idle, no `status`. - The sibling task test passes because its toast is not behind the same slow entry. This also happens to real people on slow screens: the Undo for an action that has already been written can run out before it has been painted. ## Fix (PR for this issue) The toast's view sets `toastBar.settling` on mount and clears it two frames later; the clock stands still while it is set. So a toast's time is counted from when it has been painted ("for `duration` ms from when it's visible", as the presenter's doc already says). Unit test added in `inbar.test.ts`; the e2e spec is unchanged.
kayg changed title from Palette 'Contact added · Undo' row disappears after a fixed 7 s even while hovered (composer-tasks.spec:115 fails 10/10 on WebKit) to Bar toast's clock starts when queued, not when painted: Undo is gone before a slow screen shows it (composer-tasks.spec:115 fails 10/10 on WebKit) 2026-11-05 01:05:43 +00:00
Author
Owner

Completed by #950, landed in dev via c961a41c93. Closing after verifying the fixing PR head is contained in origin/dev.

Completed by #950, landed in dev via c961a41c93c2a16e6f606693a59f2f130ee67745. Closing after verifying the fixing PR head is contained in origin/dev.
kayg closed this issue 2026-11-07 17:54:12 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#948
No description provided.