-
Notifications
You must be signed in to change notification settings - Fork 4.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
Latest Posts block breaks in Editor ('prevOffset' error) when site is in Spanish and posts have long texts #60654
Comments
I had a look for where in the block this might happen, and it seems like here might be a candidate: gutenberg/packages/block-library/src/latest-posts/edit.js Lines 485 to 509 in 727f350
It seems curious that the error happens in relation to the word count in the content, as that code mainly uses the post title It might be related to the internationalized text there - |
I've also noticed another issue in this block. UPDATE: I've created an issue here for this. |
It seems that this problem cannot be reproduced with the latest Gutenberg. The video below shows that the issue can be reproduced in WP6.5, but not in Gutenberg version 18.1.0. 922658047719a1a65be2c25e71d207fb.mp4 |
@t-hamano I installed the Gutenberg plugin and it worked. |
thanks; closing since this issue is fixed within the Gutenberg plugin; the changes from the gutenberg plugin will be integrated into a newer core version into WordPress in the future (~3-6 months). |
It might be worth identifying the PR that fixed the bug in Gutenberg and labeling it for backporting into a minor release. |
After looking into it a little more, this problem is a bit strange. This problem does occur in WP6.5.2, but it does not reproduce when I enable the Gutenberg plugin version 17.7, which should be bundled with WP6.5. Therefore, I would like to reopen this issue until we know the root cause. |
@t-hamano There's also the If it doesn't happen on that branch then I guess there might be a few reasons why it only happens in core. There's a chance that some dependencies are at the wrong version in core. I'm sure I recall in issue in the past (not recently) where React was at the wrong version in WordPress core. |
Maybe I found the cause. The outcome of this problem depends on whether the text In the Gutenberg plugin, the span tag is correctly maintained and translated as shown below. But in WordPress core, the opening span tag is incorrect. I think this problem probably occurs when invalid HTML elements are passed to the The video below shows that when a string containing invalid HTML elements is passed to the b41afac648b76dcdfed70316c0f63693.mp4This problem could be fixed by fixing the Spanish translation, but should we add some kind of safeguard to this function itself? |
A fantastic detective work, @t-hamano 🕵️♂️
Agreed, the Spanish translation team needs to fix this. I'll share this in the |
Well done tracking this down ❤️
Better error handling would be cool. Perhaps test case could be added for incorrect tags that checks the function throws a nice error message. |
I think if you share this in #polyglots, the actual GTE's can fix things like this faster ;) |
@NekoJonez, the issue was fixed and update Spanish translation should already be available. |
I submitted #60843 for improving the |
Description
When we go to Settings > General > Site Language and set it to English, nothing of what I'm going to mention next happens. Everything works correctly.
But, when we set the website to Spanish, the following happens:
If we insert a "Latest Posts" block on a page:
In that case, the following happens:
On the front end, the news always looks fine, but in the Editor, this happens:
The block remains permanently broken, without being able to change any of its options, and regardless of what I do:
That is, the problem is not in the text I have used; it would happen with any text as long as the site language is Spanish (I don't know if it happens with another language).
When the site is in English, everything works fine.
So, it seems to be related to something odd in the WordPress translations of the Spanish language.
Step-by-step reproduction instructions
TypeError: Cannot read properties of undefined (reading 'prevOffset')
at u (element.min.js?ver=c…0aebbec25b27:2:3022)
at f (element.min.js?ver=c…0aebbec25b27:2:3683)
at block-library.min.js…7eb5bf914:14:208280
Screenshots, screen recording, code snippet
In Firefox show a different error when I reproduce the same steps:
Environment info
Tested with:
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: