Skip to content

Fix: framework to detect embedded live preview in phoenix code#2756

Merged
abose merged 4 commits intomainfrom
ai
Mar 20, 2026
Merged

Fix: framework to detect embedded live preview in phoenix code#2756
abose merged 4 commits intomainfrom
ai

Conversation

@abose
Copy link
Member

@abose abose commented Mar 20, 2026

Summary

  • Added isPhoenixEmbeddedIframe to __PHOENIX_EMBED_INFO to distinguish embedded live preview iframes from popped-out
    browser windows
  • Added __PHOENIX_EMBED_INFO.onPhoenixEmbeddedInfoAvailable(callback) to detect embedded state asynchronously
  • Hidden the hot corner button in embedded iframes

API

  // Available on window.__PHOENIX_EMBED_INFO (only in non-external-browser frames)                                         
    window.__PHOENIX_EMBED_INFO && window.__PHOENIX_EMBED_INFO.onPhoenixEmbeddedInfoAvailable(function(isEmbedded) {                                         
      // isEmbedded: true if inside Phoenix, false if popped out .             
      // Guaranteed to fire in embedded iframes, but NOT guaranteed to fire in non-embedded (popped out) frames.                                                                
  });                                                                                                                       

Quirks

  • Guaranteed to fire in embedded iframes, but NOT guaranteed to fire in non-embedded (popped out) frames.
  • Assume non-embedded by default. Use this callback only to detect and react to the embedded case.
  • If isPhoenixEmbeddedIframe is already resolved when you register, the callback fires immediately.

How hot-corners uses it

Creates the hot corner optimistically, then registers onPhoenixEmbeddedInfoAvailable — if it confirms embedded, removes the hot corner. This avoids depending on the callback for the non-embedded case.

abose added 3 commits March 20, 2026 15:31
…edIframe support

Add a callback mechanism to detect when a live preview iframe is embedded
within Phoenix vs popped out. The callback is guaranteed to fire in embedded
iframes but not in non-embedded frames. Also pass isPhoenixEmbeddedIframe
in the WHO_AM_I_RESPONSE handshake.
@abose abose changed the title Don't show hot corner play button in embedded iframes Fix: framework to support detecting embedded iframes in phoenix code Mar 20, 2026
@abose abose changed the title Fix: framework to support detecting embedded iframes in phoenix code Fix: framework to detect embedded iframes in phoenix code Mar 20, 2026
@abose abose changed the title Fix: framework to detect embedded iframes in phoenix code Fix: framework to detect embedded live preview in phoenix code Mar 20, 2026
@sonarqubecloud
Copy link

@abose abose merged commit 3fd2141 into main Mar 20, 2026
17 of 21 checks passed
@abose abose deleted the ai branch March 20, 2026 11:53
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