Skip to content

PLIA-3992: Resolve preview iframe document at check time - #8

Merged
rdom-si merged 1 commit into
mainfrom
PLIA-3992
Jul 29, 2026
Merged

PLIA-3992: Resolve preview iframe document at check time#8
rdom-si merged 1 commit into
mainfrom
PLIA-3992

Conversation

@rdom-si

@rdom-si rdom-si commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes two related customer-reported bugs on the Optimizely plugin (v4.3.3): the "Run content check" button intermittently missing from the overlay, and prepublish/spellcheck not picking up content or scoring pages.
  • Root cause: siteimprove.js captured the preview iframe's document once during initialize() (via a 10s polling loop), then reused that captured reference in the onHighlight and registerPrepublishCallback closures. Any in-CMS navigation after that point replaces the iframe's document, so the callbacks kept pointing at a stale/blank document - explaining both the missing button (polling loop gave up before the iframe existed) and the empty/scoreless checks (checks ran against a blank or detached document).
  • Fix: added getPreviewDom(), which resolves the iframe's current document at call time instead of caching it once. Callbacks are now registered immediately after the IsAuthorized check, and the polling loop is removed since there's nothing to wait for anymore.
  • Bumped package version 4.3.3 -> 4.3.4 and updated the release changelog.
  • Checked in the rebuilt 4.3.4 .nupkg at the repo root, replacing 4.3.3, per this repo's existing release convention.

Test plan

  • dotnet build (Debug and Release) succeeds with no errors.
  • Verified the packaged module zip (produced by the ZipPluginContent build target) contains the updated siteimprove.js with no remaining references to the removed polling loop.
  • Manual verification against a live Optimizely CMS v12 site (e.g. the demo site referenced in PLIA-3992): confirm the "Run content check" button appears without a refresh after navigating between pages, and that a prepublish check on a page with deliberate typos shows the spelling errors and a score.

The prepublish/highlight callbacks captured the preview iframe's
document once during initialize(), then relied on a 10s polling
loop to find it. Any navigation after that point left the callbacks
pointing at a stale or blank document and could miss the iframe
entirely if it wasn't ready in time - causing the intermittent
missing "Run content check" button and prepublish checks that found
no content/errors.

getPreviewDom() now resolves the iframe's document at call time
instead of caching it, so callbacks always see the current preview.

Bump to 4.3.4 and update the release changelog.
@rdom-si
rdom-si requested a review from a team as a code owner July 28, 2026 13:15
@rdom-si
rdom-si merged commit e21ba9d into main Jul 29, 2026
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.

2 participants