Skip to content

fix: Embed renders #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 22, 2025
Merged

fix: Embed renders #140

merged 4 commits into from
May 22, 2025

Conversation

dcalhoun
Copy link
Member

@dcalhoun dcalhoun commented May 20, 2025

What?

Fix broken embed rendering.

Why?

Embeds unexpectedly launched the iOS browser rather than rendering.
Additionally, embed sizing was incorrect due to missing body class and
wrapping elements.

Fix CMM-287.

How?

Update iOS WebView request handling logic to only open link-activation requests
in the OS browser.

Add required body class for responsive embeds. See https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#responsive-embedded-content.

Add host-specific logic for removing wrapping elements from embed renders.

Testing Instructions

Tip

When testing iOS, use the prototype build: wordpress-mobile/WordPress-iOS#24556

1: Embeds can be created

  1. Insert an Embed block.
  2. Paste a YouTube URL (or other embed URL) into the input.
  3. Verify the embed renders as expected.

2: Opening a post with an embed renders the embed

  1. Open a post with an existing embed.
  2. Verify the embed renders as expected, the OS browser is not launched.

Accessibility Testing Instructions

N/A, no navigation changes.

Screenshots or screencast

N/A, no visual changes.

dcalhoun added 3 commits May 20, 2025 14:14
The previous allow list approach meant one-off requests were often sent
to the OS browser. E.g., a YouTube embed launched the OS browser rather
than displaying the embedded video within the editor.
This class is typically added by WordPress core when a theme enables the
`responsive-embeds` feature. Enabling it seems like a sounds default for
the mobile editor. Otherwise, content will not resize and overflow.

https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#responsive-embedded-content
This is host specific code that should be hoisted to the host app.
@dcalhoun dcalhoun added the [Type] Bug An existing feature does not function as intended label May 20, 2025
@dcalhoun dcalhoun marked this pull request as ready for review May 20, 2025 21:12
The `src/utils/api-fetch.js` utility now imports `@wordpress/url`. To
prevent Vite from attempting to externalize that import, we must check
if the `module` (i.e., the matched import syntax) is one of the modules
that should not be externalized.
@dcalhoun dcalhoun marked this pull request as draft May 21, 2025 19:25
@dcalhoun dcalhoun marked this pull request as ready for review May 21, 2025 20:00
@dcalhoun dcalhoun requested a review from nbradbury May 21, 2025 20:00
@nbradbury nbradbury self-assigned this May 22, 2025
Copy link
Contributor

@nbradbury nbradbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested fine! :shipit:

@dcalhoun dcalhoun merged commit d21b6c5 into trunk May 22, 2025
11 checks passed
@dcalhoun dcalhoun deleted the fix/embed-request-handling branch May 22, 2025 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants