-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Galleries with captioned images no longer function properly #17712
Galleries with captioned images no longer function properly #17712
Comments
Similar error has occurred here before: #15819 |
@wlanowski thanks for reporting this and pointing out the previous issue! I wasn't able to reproduce in WP Android 21.4. The biggest difference I can see in our setup is that I'm still on Android 12. |
I can not try 21.4 since 21.4 is not published in Google Play Store yet. For Security Reasons i am unable to install APKs or Apps from other sources on my company device. Maybe there are some errors with the Syntax. Here is the code of a post with one working gallery without any captions and a second not working gallery with a caption at the last picture. It looks strange for me. Do you see something strange here? |
As in the GIST showed, in the working galery there are only |
It looks like this is an issue relating to the Gallery v1 and v2 block HTML. As @wlanowski referenced in the gist, the working gallery HTML without captions is using Gallery block v2 syntax (
And the non-working gallery with captions is using Gallery block v1 syntax (
Support for the v1 Gallery syntax was re-introduced in WordPress/gutenberg#41533, and released in app version 20.1. My understanding is that the Gallery v1 syntax should still work in the native editor, however. The issue may be that something in the editor settings (on either app or web) is causing the Gallery block to mix the v1 and v2 syntaxes in an unknown circumstance, possibly related to captions, or the version of WordPress itself. I can continue further, but at this point I want to pause to get a second opinion. @fluiddot -- are you aware of any reason why using Gallery captions (vs. no captions) would invoke the Gallery v1 syntax (or the |
I think you hit the point @derekblank with the two versions of the Gallery block being the issue here. Version 2 of the Gallery block uses Image blocks ( I followed the steps to reproduce the behavior in a self-hosted site with WordPress 6.1.1 and couldn't reproduce the issue. I added a Gallery block, but captioning some images in this gallery and saving the post didn't make the format of the Gallery block change. Same as the results shared in this comment by @thehenrybyrd . @wlanowski If the Gallery block is being added to a site with WordPress Just to confirm, @wlanowski could you double-check that the Gallery block format changes after captioning an image? It would be very helpful if you can copy the HTML generated once you add the Gallery and then once you caption any of the images. This way we can compare the HTML code and see if there are any modifications in the format. Thanks! |
Update: The issue is still there with WP Android version 21.4, which is released today @fluiddot If I create a gallery with images and don't label an image, a gallery with v2 code comes out. When I create a gallery of images and label at least one image, a gallery comes out with v1 code and the gallery becomes uneditable and has display errors. If I edit an already created and saved v2 gallery, it remains a working v2 gallery. However, when I caption an image in this gallery, the gallery is converted to a v1 gallery on save and the errors occur. However, the phenomenon only occurs when using the iOS and Android apps! When editing and creating galleries with the browser, everything works smoothly. Here is the page report of the website in question: GIST. The error occurs with me but also on other websites. I additionally created a post for you, with one working v2 gallery and one notworking v1 gallery with a caption: LINK / Wordpress-Code in Editor / HTML-Code (GIST) |
Thank you so much @wlanowski for checking my comment and helping us to debug the problem 🙇 .
I performed another test on a self-hosted site without the Gutenberg plugin and noticed that the Gallery block is created with the V1 format. Captioning some images and saving a post results in breaking the block, as described in the issue.
It's still unclear to me what might be causing the Gallery block to change from V2 and V1 when captioning an image. In my case, I couldn't reproduce this specific case. Having a site with WordPress 5.9 or greater (e.g. version 6.1.1) should make the app to use Gallery block V2, which as far as I tested, this is not happening for the case of using a self-hosted site without the Gutenberg plugin installed. We'll investigate this issue further and figure out how to address it. @wlanowski I noticed per the page report you shared here, that your site doesn't have the Gutenberg plugin installed. While we work on a fix, you might consider installing it as this should address the issue you are experiencing. Thanks for your help 🙇 ! |
Oh! With the Gutenberg Plugin installed, the error does not occur anymore!! I tested it successfully. But why?? |
The reason for this is that the Gutenberg Plugin is used by the app to determine which version of the Gallery block should be used. By default, if the Gutenberg Plugin is not installed, the app uses the V1. However, this is no longer applicable because, in newer versions of WordPress, the default behavior is to use V2. We'll explore options to fix this issue in the app. |
Thanks for investigating this @fluiddot and @derekblank ! I think this is indeed the reason, though I'm still a bit confused how this relates to the caption (except to note that the caption has a different appearance in the v1 gallery images: overlayed). 🤔 I have debugged the scenario on a test site where the Gutenberg plugin is deactivated, and it seems that the editor settings endpoint response with a 404, and the editor theme endpoint is queried as a fallback when the plugin is not active. This is normal, afaik, but the response omits the I have opened a PR which declares this parameter as optional. This allows us to distinguish between |
I think the caption issue is just a symptom, probably the description of the issue doesn't accurately reflect the cause of the issue. For reference, I elaborated further on the cause on WordPress/gutenberg#47782.
Ah, good catch. Thanks @mkevins for investigating and sharing the results 🙇 .
Great, this way we'll cover all cases 🙂. |
Yep! Thanks for reviewing and linking up the "duplicate" issues. As a bonus, I set up a Jurassic Ninja site w/ the WP Downgrade plugin, and set WordPress core version to 5.9, and then I manually installed Gutenberg plugin v11.8.3, leaving the v2 ("Gallery block experiment") box unticked on the experiments page. In this scenario, galleries created on web are in the v1 format. Testing this with the fix results in a v1 experience on mobile, and the issue is averted (caveat is that the editor settings must be fetched at least once prior to loading the content in question, e.g. by opening a different post, or creating a new one). |
Update: In the scenario described above (Gutenberg plugin v11.8.3 on WordPress code version 5.9), everything was working smoothly with v1 galleries (also confirmed that the |
Yes, I had the same issue... Only after adding a caption to at least one image, the error occurs. But is it fixed in current versions? Is this issue ready for closing? |
This should be resolved when using the latest versions (of WordPress, as well as the Gutenberg plugin).
Good question. The "edge" case described above is, imo, a valid scenario, though it's hard to say how frequently this will be encountered. If re-opened, I'd think it would be pretty low priority, unless this turns out to be more common than expected. I did a little more debugging, and it looks like the validation issue I encountered is:
and this was on a gallery with only one image, so the |
Some additional debugging info which might help in tracking down the root cause:
Notice the extra |
@mkevins Oh, good catch, I also managed to reproduce the issue using WordPress 5.9.7 and Gutenberg 14.7.3. If in the web version, I create a Gallery and set any caption to the images, when opening that post in the app, it results in a block error. I'm encountering the same error when using WordPress 5.8 and Gutenberg 13.6.0. I'm wondering if there's a difference in the implementation of Gallery v1 between the web and native that produces this error. @derekblank since you've been working on the fix, could you take a deeper look? Thanks! In any case, I agree this issue at least for Gallery v1 can't be marked as closed so I'm reopening it. |
The core issue appears to be due to the wrong selector being used for a Gallery block v1 caption. When a caption is added to an image in a v1 Gallery, the caption's class selector is @mkevins and I isolated a fix for the captions issue that makes this change, and can be tested in this PR: |
Now that WordPress/gutenberg#51076 is merged we can close the issue. Note that, as I shared here, this issue is likely to keep happening in the web version. |
Expected behavior:
Actual behavior:
Steps to reproduce the behavior:
Tested on [device], Android [version], WPAndroid [version]:
Tested on a Samsung Galaxy A52, with Android 13, WordPress app version 21.3
Tested on 2 different WordPress instances with version 6.1.1
The text was updated successfully, but these errors were encountered: