Skip to content

fix: add iframe document fallback to avoid silently skipping iOS patch#1256

Merged
superdav42 merged 1 commit into
mainfrom
feature/auto-20260521-234644-gh1249
May 22, 2026
Merged

fix: add iframe document fallback to avoid silently skipping iOS patch#1256
superdav42 merged 1 commit into
mainfrom
feature/auto-20260521-234644-gh1249

Conversation

@superdav42
Copy link
Copy Markdown
Collaborator

@superdav42 superdav42 commented May 22, 2026

Summary

Updated iframe body lookup in template-previewer.js to use contentWindow?.document as fallback, ensuring iOS patch runs reliably on all platforms.

Changes

  • Reuse existing iframe reference instead of re-querying DOM
  • Add contentWindow?.document fallback for iOS compatibility
  • Ensures iOS patch runs reliably on all platforms

Verification

  • Verified diff shows correct fallback chain: contentDocument || contentWindow?.document
  • Code follows existing patterns in the file

Resolves #1249


aidevops.sh v3.17.27 plugin for OpenCode v1.15.7 with claude-haiku-4-5 spent 39s and 2,218 tokens on this as a headless worker.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced iframe styling compatibility on iOS devices for the template previewer, ensuring more reliable content display.

Review Change Stack

- Reuse existing iframe reference instead of re-querying DOM
- Add contentWindow?.document fallback for iOS compatibility
- Ensures iOS patch runs reliably on all platforms

Resolves #1249
@superdav42
Copy link
Copy Markdown
Collaborator Author

MERGE_SUMMARY

Status: Ready to merge

What was done:

  • Fixed iframe body lookup in template-previewer.js (lines 77-78)
  • Added contentWindow?.document fallback for iOS compatibility
  • Reused existing iframe reference instead of re-querying DOM

How verified:

Closes: #1249


aidevops.sh v3.17.27 plugin for OpenCode v1.15.7 with claude-haiku-4-5 spent 46s and 2,525 tokens on this as a headless worker.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: abfc6ed5-1956-4aeb-b6b2-81a233bbdc9b

📥 Commits

Reviewing files that changed from the base of the PR and between a80f017 and 832b162.

📒 Files selected for processing (1)
  • assets/js/template-previewer.js

📝 Walkthrough

Walkthrough

This PR refactors the iOS iframe styling code to eliminate unnecessary DOM re-querying and add a fallback access path. The iframe body lookup now reuses the existing iframe variable and uses optional chaining with a contentWindow.document fallback to ensure the iOS patch executes reliably.

Changes

iOS iframe document lookup

Layer / File(s) Summary
iframe body reference refactoring
assets/js/template-previewer.js
Replace document.getElementById("iframe") with the scoped iframe variable and add contentWindow?.document fallback, ensuring the iOS patch for iframe body styling runs reliably across platforms.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested labels

review-feedback-scanned, origin:worker

Poem

🐰 A scope already held,
No re-query needed, just a step—
contentWindow as backup plan,
iOS patch, now solid and grand,
Efficiency hops through the sand! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding an iframe document fallback mechanism to prevent the iOS patch from being skipped.
Linked Issues check ✅ Passed The PR implements the exact fallback chain (contentDocument || contentWindow?.document) specified in issue #1249, reuses the existing iframe reference, and prevents silent platform-specific failures.
Out of Scope Changes check ✅ Passed The changes are directly aligned with the single objective in issue #1249—adding iframe document fallback logic with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feature/auto-20260521-234644-gh1249

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 and usage tips.

@superdav42 superdav42 merged commit 769b690 into main May 22, 2026
11 checks passed
@superdav42
Copy link
Copy Markdown
Collaborator Author

Summary

Updated iframe body lookup in template-previewer.js to use contentWindow?.document as fallback, ensuring iOS patch runs reliably on all platforms.

Changes

  • Reuse existing iframe reference instead of re-querying DOM
  • Add contentWindow?.document fallback for iOS compatibility
  • Ensures iOS patch runs reliably on all platforms

Verification

  • Verified diff shows correct fallback chain: contentDocument || contentWindow?.document
  • Code follows existing patterns in the file

aidevops.sh v3.17.27 plugin for OpenCode v1.15.7 with claude-haiku-4-5 spent 39s and 2,218 tokens on this as a headless worker.


Merged via PR #1256 to main.
Merged by deterministic merge pass (pulse-wrapper.sh).

@github-actions
Copy link
Copy Markdown

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@github-actions
Copy link
Copy Markdown

Performance Test Results

Performance test results for e19db10 are in 🛎️!

Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown.

URL: /

Run DB Queries Memory Before Template Template WP Total LCP TTFB LCP - TTFB
0 41 37.79 MB 879.00 ms 166.00 ms (+5.50 ms / +3% ) 1088.50 ms 2068.00 ms 1990.60 ms 78.45 ms (+4.35 ms / +6% )
1 56 49.13 MB 963.50 ms (+65.00 ms / +7% ) 144.50 ms (+8.00 ms / +6% ) 1112.50 ms (+78.50 ms / +7% ) 2122.00 ms (+88.00 ms / +4% ) 2051.10 ms (+94.75 ms / +5% ) 72.65 ms

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.

quality-debt: assets/js/template-previewer.js — PR #1245 review feedback (medium)

1 participant