Skip to content

[bugfix] Restore video playback after view-transition navigation on comfy.org - #15010

Merged
imick-io merged 1 commit into
mainfrom
fix/view-transition-video-playback
Aug 11, 2026
Merged

[bugfix] Restore video playback after view-transition navigation on comfy.org#15010
imick-io merged 1 commit into
mainfrom
fix/view-transition-video-playback

Conversation

@imick-io

Copy link
Copy Markdown
Collaborator

Summary

A recent Chrome update broke every <video>/<audio> on comfy.org when the page is reached via Astro <ClientRouter /> soft navigation (e.g. /learning → a tutorial watch page): the router parses the incoming page with DOMParser into an inert document where the media stack is never initialised, so swapped-in media reports MEDIA_ERR_SRC_NOT_SUPPORTED ("no supported sources") despite a valid src. Hard refresh works; any client-side navigation does not.

Changes

Review Focus

  • Timing: astro:after-swap fires synchronously after the swap, before island hydration microtasks run, so Vue never binds to the stale elements. Verified in Chromium: watch-page autoplay + custom controls, and home-page scroll-triggered loops all behave identically to a hard load after soft navigation.

A Chrome update broke media elements swapped in by Astro's ClientRouter:
DOMParser parses the incoming page into an inert document where the
media stack is never initialised, so every video/audio reports 'no
supported sources' after any soft navigation. Replace swapped-in media
elements with fresh live-document copies on astro:after-swap, mirroring
the not-yet-released upstream fix (withastro/astro#17603), and carry the
muted property across so muted autoplay loops still start.
@imick-io
imick-io requested a review from a team August 10, 2026 22:08
@imick-io imick-io added the verified bug Something isn't working (confirmed by the team) label Aug 10, 2026
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 10, 2026
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

🌐 Website E2E

Tip

All tests passed.

Status ✅ Passed
Report View Report

🔗 Website Preview

Website Preview: https://comfy-website-preview-pr-15010.vercel.app

This commit: https://website-frontend-29ht5al1a-comfyui.vercel.app

Last updated: 2026-08-10T22:10:03Z for e5a77c5

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5d5c67ee-7690-4610-bde7-7bc75c1660e3

📥 Commits

Reviewing files that changed from the base of the PR and between 26a6bf7 and e5a77c5.

📒 Files selected for processing (3)
  • apps/website/src/layouts/BaseLayout.astro
  • apps/website/src/scripts/reifyMediaElements.test.ts
  • apps/website/src/scripts/reifyMediaElements.ts

📝 Walkthrough

Walkthrough

The change adds reifyMediaElements, which recreates video and audio elements after Astro navigation swaps. The helper preserves attributes, content, muted state, and DOM position. Tests cover the reification behavior.

Changes

Media reification after navigation

Layer / File(s) Summary
Media element reification
apps/website/src/scripts/reifyMediaElements.ts, apps/website/src/scripts/reifyMediaElements.test.ts
The new helper recreates video and audio descendants with preserved attributes, content, muted state, and positions. Tests cover these behaviors.
Post-swap integration
apps/website/src/layouts/BaseLayout.astro
The layout calls reifyMediaElements(document.body) after each astro:after-swap event.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary bug fix: restoring video playback after view-transition navigation.
Description check ✅ Passed The description includes the required summary, changes, and review focus sections with clear technical details.
Linked Issues check ✅ Passed The implementation directly satisfies issue #17603 by reifying media elements after swaps and preserving playback-related state.
Out of Scope Changes check ✅ Passed The code and tests are limited to restoring media functionality after client-side navigation.
End-To-End Regression Coverage For Fixes ✅ Passed All listed changed files are under apps/website, and the check explicitly excludes changes exclusively in apps/website from failure.
Adr Compliance For Entity/Litegraph Changes ✅ Passed The changed files are under apps/website/src and do not modify src/lib/litegraph/, src/ecs/, or graph entity files, so this check does not apply.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/view-transition-video-playback

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@deepme987

Copy link
Copy Markdown
Contributor

blind approving, expectation is it's tested e2e

@imick-io
imick-io added this pull request to the merge queue Aug 10, 2026
Merged via the queue into main with commit c3ffeba Aug 11, 2026
69 of 71 checks passed
@imick-io
imick-io deleted the fix/view-transition-video-playback branch August 11, 2026 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files. verified bug Something isn't working (confirmed by the team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants