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

[Mobile] Gallery "Link To -> Attachment Page" option not creating an anchor #23576

Closed
mkevins opened this issue Jun 30, 2020 · 4 comments · Fixed by #40947
Closed

[Mobile] Gallery "Link To -> Attachment Page" option not creating an anchor #23576

mkevins opened this issue Jun 30, 2020 · 4 comments · Fixed by #40947
Assignees
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended

Comments

@mkevins
Copy link
Contributor

mkevins commented Jun 30, 2020

Describe the bug
The "Link To" setting for Gallery block is not working for the "Attachment Page" option.

To reproduce

  1. Create a Gallery block with a few images
  2. Tap the settings gear
  3. Tap the "Link to" setting and select "Attachment Page"
  4. Save the post
  5. Preview the post on web

Expected behavior
The images in the gallery should link to the respective attachment page

Smartphone (please complete the following information):

  • Device: Pixel 3a
  • OS: Android 10 - Device: [e.g. iPhone6]

Additional context
This seems to primarily affect self-hosted sites, since .com sites appear to use a separate mechanism to display the images (via JS instead of an anchor).

In debugging this a bit, I discovered that this issue is not present for gallery images that have completed uploading while the editor is closed. The processor is adding the data-link attribute, which I believe is absent from the media upload object returned to the editor when completed while the editor is open.

@mkevins mkevins 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) [Block] Gallery Affects the Gallery Block - used to display groups of images labels Jun 30, 2020
@mkevins mkevins self-assigned this Jun 30, 2020
@mkevins
Copy link
Contributor Author

mkevins commented Jul 9, 2020

In debugging this a bit further, it seems that the absense of the data-link attribute is ok (even desired) on .com sites. For those sites, JavaScript is used to display the image in a modal when clicked, rather than relying on the anchor, which is absent when no data-link is present and the linkTo is set to attachment page.

For self-hosted sites, we do not have attachment page link in our media model, so we cannot pass it back to JS. To conform to more stringent specification, we did implement the generation of this value in the implementation of the gallery upload completion processor, which explains why the links work correctly for images that have completed uploading outside the editor.

The endpoints used for which the media model is derived do not directly have the attachment page link (.com v1.1 and XMLRPC), though confusingly, the XMLRPC does have a "link" in the response which appears to be the equivalent to the "url" from the REST APIs, and not the same as the WP API "link".

@mkevins mkevins changed the title [Android] Gallery "Link To -> Attachment Page" option not creating an anchor [Mobile] Gallery "Link To -> Attachment Page" option not creating an anchor Jul 9, 2020
@mkevins mkevins removed their assignment Apr 20, 2021
@TheAggressive
Copy link

I also found this behavior when:

  • You create a gallery in the classic editor (Old Posts)

  • Try to convert the classic editor gallery to a block gallery.

The "Media File" option gets an anchor but if you switch the option to "Attachment Page" and update the post, no anchor tag get generated and hence no link to the the attachment page. Emptied cache as well to ensure it's not a caching issue.

@dcalhoun
Copy link
Member

dcalhoun commented Dec 7, 2021

This issue appears to now occur for both Media File and Attachment Page options. Selecting either option starting with WordPress apps 18.5 / Gutenberg Mobile v1.64.0 does not insert the expected anchor tag. It also is not specific to self-hosted sites, as it occurs on WordPress.com sites as well.

@mchowning mchowning added the [Priority] High Used to indicate top priority items that need quick attention label Feb 8, 2022
@mchowning
Copy link
Contributor

In light of @dcalhoun 's findings (which I have also observed), I'm going to go ahead and add a "high" label to this since the flow of changing the link type seems to be completely broken across all sites. Feels like we need to either fix this or remove the "Link To" setting from mobile.

FWIW, I noticed that if I take a gallery from web with valid Link To settings, and add an image to the gallery, the new image has no Link To behavior, but the pre-existing images in the gallery (originally added on web), still retain their previous Link To behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants