Wp-calypso: Video Block: HTML Anchor Automatically Removed

Created on 9 Nov 2020  Â·  9Comments  Â·  Source: Automattic/wp-calypso

Steps to reproduce

  1. Go to: WordPress.com > My Sites > Site > Pages > and select either existing or Add New Page
  2. Add a new video block to page content
  3. Go to the Advanced Tab
  4. Add anchor text in HTML Anchor section
  5. Select "Publish" or "Update" if the page is already published
  6. Refresh browser page

What I expected

I'd expect the HTML Anchor text to remain where it was last inputted.

What happened instead

The HTML Anchor text is gone and anchor link does not work.

Browser / OS version

Screenshot / Video

Video
Original video link: https://d.pr/i/etZxgK/Ge5aTkPRl2

Context / Source

user-report

Blocks [Pri] High [Type] Bug

All 9 comments

Confirmed in Chrome on Mac. Setting a priority level of high because the anchor link setting doesn't work at all, and it appears as if there are no workarounds.

  • The network request made when publishing block editor updates _does not_ include anchor tag updates to the video block. It does, however, include anchor tag updates to paragraph blocks, image blocks, etc.
  • An anchor tag applied to a video placeholder is persisted

@jeyip I did a little bit of looking into this, too, hopefully this might help:

So, I'm wondering if we need to do something similar in Jetpack to add support for the attributes/props in the overridden video block's edit and save methods?

@andrewserong

I think the theory about blockProps makes a ton of sense, but I'm stumped about one thing -- I couldn't seem to reproduce the issue in a local environment earlier with jetpack, and I still can't seem to do so. I wonder why 🤔

Either way, I'll definitely start exploring this.

@jeyip I haven't (yet) been able to reproduce either in a Jetpack site, but I think we might need to use a paid plan to be able to test it there. A few more links from some digging 😀 :

And in that check, it looks like it only returns an array with 'available' => true if there's a paid plan, so the core/video block is probably only getting overridden when the paid Jetpack or wpcom plan is present.

Ahhh I see. I'll try to replicate the problem. Going to hard code check_videopress_availability to true in a local jetpack dev environment.

If we can reproduce it, I think we'll be in a good place 🙂

Hmmm... having trouble getting hard coded values to work.

The local environment has been early returning with a fall back to the Core Video Editor: https://github.com/Automattic/jetpack/blob/dcfa5ca8bd/extensions/blocks/videopress/edit.js#L293-L295

This might explain why I've been unable to reproduce the problem in a dev environment.

Still chugging along. Spent today filling in _a lot_ of gaps in knowledge about jetpack and setting up a local tunnel and "connecting" my local jetpack environment with a paid plan. I'm pretty confident that the reason we couldn't replicate the issue locally was because, when unconnected, our dev environment wasn't uploading videos to jetpack videopress servers.

This was causing the fallback to the Core Video Editor, which doesn't share the same HTML anchor tag issues. I've connected jetpack successfully, but am now having trouble uploading videos at all. Will update here as I make progress.

A little more info on useBlockProps: https://make.wordpress.org/core/2020/11/18/block-api-version-2/ — I wonder if it might be tricky adding in the appropriate support so that WP 5.6 / current Gutenberg versions get the appropriate id attribute in the markup, but folks running Jetpack on earlier versions don't run into block validation issues / errors because useBlockProps isn't available... 🤔

Was this page helpful?
0 / 5 - 0 ratings