Skip to content

[Web] Load editor canvas assets with backtick iframe tags - #4532

Merged
adamziel merged 1 commit into
trunkfrom
gutenberg-iframe-quotes
Oct 28, 2026
Merged

adamziel merged 1 commit into
trunkfrom
gutenberg-iframe-quotes

Conversation

@adamziel

@adamziel adamziel commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #4531.

Gutenberg's Rolldown output uses backticks around iframe. Playground only matched double quotes, leaving the editor canvas as a blob: document without a service worker. CSS and font requests then reached the web server and returned 404.

Accept matching double quotes, single quotes, or backticks. Keep the existing controlled-iframe wrapper and request routing.

Adds browser regressions for single quotes and backticks. The backtick case fails on trunk. Existing tests cover the older double-quoted output.

Before / after

Gutenberg PR #85811 on WordPress 7.1, using the built two-origin preview. Screenshots live on a separate image-only branch.

Size Before After
Desktop Desktop before Desktop after
Mobile Mobile before Mobile after

Testing

  1. Open the PR preview with ?gutenberg-pr=85811.
  2. Add a post. Check that the title and paragraph placeholders appear.
  3. Check that the canvas uses /wp-includes/empty.html and its CSS and fonts load.

Verified locally: 127 remote tests; Chromium and WebKit editor checks; remote and website type checks and lint. The exact Gutenberg PR also renders correctly at desktop and mobile widths. Firefox could not launch locally because of a macOS sandbox error.

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility when loading the post editor across older and newer builds. The editor now recognizes iframe calls using double quotes, single quotes, or backticks, helping ensure the editor canvas loads correctly.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fd94a1cf-8c44-48e6-921e-639a5edebd56
Commits

Reviewing files that changed from the base of the PR and between 9d4a948 and 07ff6a9.

Files selected for processing: 2
  • packages/playground/remote/service-worker.ts
  • packages/playground/website/playwright/e2e/service-worker-empty-html.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Walkthrough

The service-worker iframe-call rewrite now matches single-quoted and backtick-quoted tag names, in addition to double-quoted names. End-to-end tests cover the added quote styles in the WordPress post editor.

Changes: Gutenberg iframe rewrite

Layer / File(s) Summary
Extend iframe matching and test the post editor
packages/playground/remote/service-worker.ts, packages/playground/website/playwright/e2e/service-worker-empty-html.spec.ts
The rewrite matches iframe tag names enclosed in single quotes or backticks. Tests restore an omitted script, change the quote style, and check the editor canvas, title textbox, and service-worker controller.

Priority: Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

Suggested labels: [Package][@wp-playground] Remote, [Aspect] Service Worker, [Aspect] Browser, [Package][@wp-playground] Website

Suggested reviewers: janjakes

Merge Risk: Minimal · up to 07ff6

The change addresses the editor iframe asset-loading issue. No merge-blocking risk was identified.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: loading editor canvas assets by supporting backtick-quoted iframe tags.
Linked Issues check Passed [#4531] Requirement: editor iframe assets load and the canvas is styled. Root cause: the service worker rewrite in packages/playground/remote/service-worker.ts matched only double-quoted ("iframe",.…
Out of Scope Changes check Passed The PR changes two files. (1) packages/playground/remote/service-worker.ts (+2/-1) changes only the iframe-call regex, with a comment explaining the Rolldown backtick output. This directly implements …
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

[#4531] Requirement: editor iframe assets load and the canvas is styled. Root cause: the service worker rewrite in packages/playground/remote/service-worker.ts matched only double-quoted ("iframe",. Rolldown output uses backticks, so the canvas document did not receive the controlled-iframe wrapper and its assets returned 404. The change to /\(\s*(["'])iframe\1,/matches double quotes, single quotes, or backticks, and requires the same quote on both sides. The replacement(__playground_ControlledIframe,and the wrapper prefix are unchanged, so request routing is unchanged. The added Playwright tests (single quotes and backticks) assert that the canvas uses/wp-includes/empty.html`, that the 'Add title' textbox is visible, and that the canvas frame has a service worker controller. The fix addresses the reported cause. The live Gutenberg PR 85811 result is author-reported only and was not re-run during this review.

Full details: Out of Scope Changes check

Explanation

The PR changes two files. (1) packages/playground/remote/service-worker.ts (+2/-1) changes only the iframe-call regex, with a comment explaining the Rolldown backtick output. This directly implements [#4531]. (2) packages/playground/website/playwright/e2e/service-worker-empty-html.spec.ts (+47) adds parameterized regression tests for single-quoted and backtick iframe calls. These tests support the same objective. No unrelated refactoring, feature, or configuration change appears in the reviewed whole-PR diff against the merge base.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@adamziel
adamziel merged commit 96cac8f into trunk Oct 28, 2026
62 checks passed
@adamziel
adamziel deleted the gutenberg-iframe-quotes branch October 28, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Block editor iframe assets not loading

1 participant