Skip to content

Contain window-reveal play failures and stop over-promising owner - #464

Merged
epeicher merged 1 commit into
trunkfrom
fix/window-reveal-review-findings
Jul 31, 2026
Merged

Contain window-reveal play failures and stop over-promising owner#464
epeicher merged 1 commit into
trunkfrom
fix/window-reveal-review-findings

Conversation

@epeicher

@epeicher epeicher commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #459, fixing review findings that surfaced after it merged.

Play failures could strand a window under the armed surface

Element.animate() throws on an easing it cannot parse — at play time, after the opaque armed surface is already covering the window and before any finish/cancel handler is attached. The exception escaped playWindowReveal into the WINDOW_CONTENT_LOADED action, so the window stayed covered on every load, the loading-overlay teardown never ran, and the remaining subscribers for that event were cut off. The custom-render path already guarded its third-party callback; the clip-path path now gets the same containment:

  • Registration rejects an unparsable easing. A throwaway KeyframeEffect runs the same parser animate() uses, so the bad string dies with a stack frame at registration time. Environments without the Web Animations API accept everything — they never call animate().
  • playWindowReveal survives a throwing animate() (a def injected through the desktop-mode.window-reveals filter never went through registration) by dropping that layer, and it now clears the --revealing pin when every layer bailed.
  • The play-time def lookup survives a throwing filter callback by degrading to "no reveal": layers removed, content uncovered.

owner was documented as something it does not do

The reveal def table, the example, and the registerWindowReveal docblock all said owner gets a reveal live-unregistered on plugin deactivation. unregisterWindowRevealsByOwner() exists, but nothing calls it on the deactivation path — reveals have no PHP script-registration companion yet, the same known gap as palettes that the reference already acknowledged a paragraph later. The docs now describe owner as a grouping tag that starts working the moment the sweep lands, rather than promising a sweep that does not exist. Wiring the actual sweep (payload key + src/reveals/server-sync.ts, per the established pattern) is left as a follow-up since it adds PHP API surface.

Stale docblocks from the default flip

The commit that defaulted reveals to off missed two docblocks still claiming 'sweep' as the shipped default (src/settings/registry.ts, src/settings/types.ts — the file the JS reference names as the authoritative snapshot shape) and two more claiming "five built-ins" (there are twelve).

Tests

  • Registration rejects a non-string easing and an unparsable easing (stubbed KeyframeEffect), and still accepts valid ones.
  • A throwing animate() uncovers the window and clears the --revealing pin instead of propagating.
  • A throwing reveals filter at play time uncovers the window instead of stranding it.

All suites green: eslint, tsc, vitest (2748), PHPUnit (1700).

Open WordPress Playground Preview

`Element.animate()` throws on an easing it cannot parse, and it did so
at play time — after the opaque armed surface was already covering the
window, and before any finish handler was attached. The window stayed
covered on every subsequent load, and the throw escaped into the
WINDOW_CONTENT_LOADED action, cutting off the loading-overlay teardown
and the remaining subscribers. Three layers of containment:

- Registration rejects an easing the browser cannot parse — a
  throwaway KeyframeEffect runs the same parser animate() uses, so the
  string dies with a stack frame at registration instead.
- playWindowReveal survives a throwing animate() (a def injected via
  the `desktop-mode.window-reveals` filter never went through
  registration) by dropping that layer, and clears the `--revealing`
  pin when every layer bailed.
- The play-time def lookup survives a throwing filter callback by
  degrading to "no reveal": layers removed, content uncovered.

Also aligns the docs with what ships. `owner` on a reveal def was
documented as live-unregister-on-deactivate, but nothing sweeps reveals
by owner yet — there is no PHP script-registration companion (same
known gap as palettes) — so the docs now call it a grouping tag that
starts working the moment the sweep lands. And the default-flip commit
missed docblocks still claiming `'sweep'` as the shipped default and
"five" built-ins: the default is `'none'` and there are twelve.
@epeicher epeicher self-assigned this Jul 31, 2026
@epeicher
epeicher merged commit 1134c48 into trunk Jul 31, 2026
5 checks passed
@epeicher
epeicher deleted the fix/window-reveal-review-findings branch July 31, 2026 13:27
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