Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#34462 closed enhancement (fixed)

Add a text fallback for the embed iframe

Reported by: pento's profile pento Owned by: pento's profile pento
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.4
Component: Embeds Keywords:
Focuses: Cc:

Description

Suggested by @helen:

I would like to see a text fallback (e.g. a link) provided in the oEmbed response, much like the way Twitter includes a blockquote. I wouldn’t want to see more text from the site, but the title/site name would probably suffice.

This can be included in the oEmbed response data, then hidden when we get a message from the iframe to signal that it loaded correctly.

Attachments (2)

34462.diff (2.6 KB) - added by pento 9 years ago.
34462.2.diff (5.5 KB) - added by pento 9 years ago.

Download all attachments as: .zip

Change History (10)

@pento
9 years ago

#1 @pento
9 years ago

  • Keywords has-patch added

34462.diff is a first pass at this.

I don't really like the flash of fallback text that appears before it's hidden, but this is the same behaviour you see with Twitter.

#2 @swissspidy
9 years ago

How would that look like when JavaScript is disabled? I guess the iframe needs to be hidden initially. That would work well with #34451 in mind too.

#3 @swissspidy
9 years ago

Also, the if ( empty( $content[1] ) && empty( $content[2] ) ) check means a <blockquote> is required, right? I don't think it should be. If we use blockquotes, it doesn't mean every other oEmbed provider does as well.

@pento
9 years ago

#4 @pento
9 years ago

in 34462.2.diff:

  • Hide the iframe by default (if a blockquote fallback is present), then display it once it sends a message, hiding the blockquote at the same time. This causes a bit less jumping around.
  • Require an iframe to be present, instead of previously requiring either a blockquote or an iframe.
  • Add some unit tests.

#5 @pento
9 years ago

  • Owner set to pento
  • Resolution set to fixed
  • Status changed from new to closed

In 35437:

Embeds: Provide a cached text fallback.

Sometimes, embedded sites might suffer from less than 100% uptime. Instead of leaving the embedding site with a big blank space where the embed should be, let's fall back to a link to the embedded post, so there's at least some context for the post.

Fixes #34462.

#6 follow-up: @swissspidy
9 years ago

  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

You'll never receive a postMessage from an iframe that is hidden using display: none.

I'll try to fix this together with #34451.

#7 in reply to: ↑ 6 ; follow-up: @pento
9 years ago

Replying to swissspidy:

You'll never receive a postMessage from an iframe that is hidden using display: none.

Which browser did you test this on? It works fine for me in Chrome, Firefox and Safari.

#8 in reply to: ↑ 7 @swissspidy
9 years ago

  • Keywords needs-patch removed
  • Resolution set to fixed
  • Status changed from reopened to closed

Replying to pento:

Replying to swissspidy:

You'll never receive a postMessage from an iframe that is hidden using display: none.

Which browser did you test this on? It works fine for me in Chrome, Firefox and Safari.

Chrome. I just tested this again on trunk and couldn't reproduce it, so I guess it was something I introduced myself while working on #34451. So, sorry for acting too hastily.

Note: See TracTickets for help on using tickets.