Skip to content
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

Image block Attachment Page link option lingers after switching to media to external URL #36266

Open
dcalhoun opened this issue Nov 5, 2021 · 2 comments
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Type] Bug An existing feature does not function as intended

Comments

@dcalhoun
Copy link
Member

dcalhoun commented Nov 5, 2021

Description

If an Image block uses self-host media and has a "Link To" set to "Attachment Page," changing the media to be an external image URL in the web editor leaves the mobile editor displaying a stale "Link To" value of "Attachment Page." This was discovered in #34846, as that work enabled this issue to be visible.

Step-by-step reproduction instructions

  1. Add an Image block in the mobile editor.
  2. Set the media to a self-hosted image.
  3. Tap the settings cog button to open the block settings.
  4. Tap "Link To."
  5. Tap "Attachment Page."
  6. In the web editor, edit the same Image block by clicking "Replace."
  7. Click "Edit" for the "Current media URL" and paste a remotely hosted image URL.
  8. In the mobile editor, edit the same Image block and open the blocks settings once again.

Expected behaviour

The "Link to" continues to be set to the self-hosted image and displays as a "Custom URL."

Actual behaviour

The "Link to" continues to be set to the self-hosted image and displays as "Attachment Page." The "Attachment Page" option is not available in the list of items, which makes its display even more odd.

Screenshots or screen recording (optional)

image-block-stale-link-to.MP4

WordPress information

  • WordPress version: WordPress.com
  • Gutenberg version: 11.8.0
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? No, Quadrat

Device information

  • Device: iPhone SE
  • Operating system: iOS 15.1
  • WordPress app version: f871c50
@dcalhoun dcalhoun added [Type] Bug An existing feature does not function as intended Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) labels Nov 5, 2021
@mchowning mchowning assigned mchowning and unassigned mchowning Dec 9, 2021
@mchowning
Copy link
Contributor

Seems like this might not really be a mobile issue. I notice that on the web, the following happens

  1. Create an image block with an image block from the media library
  2. Set the link type to be attachment page
  3. "Replace" the image with an external image url link
  4. View the source code for the block and observe that it still has a linkDestination of "attachment"
<!-- wp:image {"sizeSlug":"large","linkDestination":"attachment"} -->
<figure class="wp-block-image size-large"><a href="https://mattstestpremiumsite6246.photo.blog/2021/08/04/o/wp_story1628105205876_06886781375064284519/"><img src="https://images.theconversation.com/files/391059/original/file-20210323-23-pvr9g2.jpg?ixlib=rb-1.1.0&amp;q=45&amp;auto=format&amp;w=1200&amp;h=675.0&amp;fit=crop" alt=""/></a></figure>
<!-- /wp:image -->

Assuming "Attachment Page" is not a valid "linkDestination" for an image block with an externally linked image, then it feels like the issue is more that the linkDestination value remains "attachment" after replacing with an external image on web (I don't think we can assign a custom url to an image on mobile unless we manually edit the HTML). Mobile is just reflecting the linkDestination value in the UI.

I'll remove my assignment since I'm not clear on the desired/expected behavior at this point.

@dcalhoun
Copy link
Member Author

dcalhoun commented Dec 9, 2021

it feels like the issue is more that the linkDestination value remains "attachment" after replacing with an external image on web

@mchowning I agree now that you share your findings.

I'll remove my assignment since I'm not clear on the desired/expected behavior at this point.

I would imagine the expected behavior is that the when the image is replaced to an external URL that either (1) href and linkDestination are cleared or (2) the linkDestination is set to custom — probably the latter. WDYT?

@mchowning mchowning added Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) and removed Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) labels Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants