The page freezes while the Real-Time SEO module runs script after changing something in a field and trigger onBlur on the field (click outside the field). This makes updating a page take extremely long.

Proposed solution:
Make Real-Time SEO widget auto refresh configurable from module form. If auto refresh is disabled then the button to update the widget will be appeared. An administrator will decide whether should this be turned on or not.

And I guess this should have an update hook for existing installations to inform about the new option and keep the value enabled like before? (BC)

Issue fork yoast_seo-3008802

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

knyshuk.vova created an issue. See original summary.

knyshuk.vova’s picture

Status: Active » Needs review
StatusFileSize
new19.02 KB

What was done with this patch:
- Replaced SettingsController with SettingsForm.
- Used Link::fromTextAndUrl() instead of deprecated \Drupal::l()
- Added ability to change auto refresh status from configuration form.
- Displayed the button on the Real-Time SEO widget to update the widget if auto refresh is disabled.

Status: Needs review » Needs work
knyshuk.vova’s picture

StatusFileSize
new19.02 KB

Changed auto refresh default value according to schema definition

knyshuk.vova’s picture

Status: Needs work » Needs review
knyshuk.vova’s picture

StatusFileSize
new19.1 KB

Changed new field title and description to be more user friendly

knyshuk.vova’s picture

Assigned: knyshuk.vova » Unassigned
kingdutch’s picture

Hi knyshuk.vova,

Thank you for your bug report and patch. Before we review and commit this I'd like to explore an alternative route.

Could you give some more information about:

  • The entity and fields that you're analysing
  • Your browser, browser version and operating system
  • Whether you're experiencing this issue for all fields or only when editing a specific field

I think the automatic refreshing is a very useful feature for real-time feedback. I'd prefer to ensure the slowdown is avoided altogether and keep the auto-refresh working than to disable that functionality altogether. If we find that the slowdown is unavoidable then we can always use this solution but I consider it a last resort.

Thanks!

kingdutch’s picture

Status: Needs review » Postponed (maintainer needs more info)
redeight’s picture

Not sure if it is related to this issue, but while the Yoast SEO widget is running, my page is completely unresponsive. Can't click anything. It is essentially locked up, but I can still scroll.

I'm using it on the Body field of the basic page content type.
Browser is Chrome Version 74.0.3729.169 (Official Build) (64-bit) (chrome on Ubuntu 18.04)

But my coworkers experience the same on their Macs.

This happens both when the edit page is first loaded (completely locked up for about 10 or more seconds) and anytime I defocus (onBlur) the body field....

willibautista’s picture

Hi!

I have the same issue, the page freeze but I can still scroll.

I'm using it on the Body field.
Browser: Chrome 87.0.4280.141
Operating system: Ubuntu 20.04.1 LTS
Drupal Version: 9.0.11
Yoast seo version: 8.x.1.7

Thanks a lot.

lorisbel’s picture

I have the same problem: editing a page is a pain since the form totally freezes. I think that SEO should work in background without blocking the page load.

anybody’s picture

Status: Postponed (maintainer needs more info) » Active

Confirming the issue. The page freezes while Yoast Seo is processing (running spinner).

#6 is a nice workaround, but a better solution would be to make the script non-blocking (async).

anybody’s picture

Is the maintainer inactive or doesn't care? ;D This makes the module close to unusable... just to say... ;)

socialnicheguru’s picture

Status: Active » Needs review

would working with this version of Metatag help at all?

the_turk’s picture

#6 is not applying to the current dev version. I am including a new patch.

flefle’s picture

Attached bellow is the ported patch for 2.0.0-alpha8. Could it please be include in the next version?

Status: Needs review » Needs work

The last submitted patch, 17: yoast_seo--page-freeze-at-script--3008802-17.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

nixou’s picture

Status: Needs work » Needs review
StatusFileSize
new19.44 KB

Reroll for 2.0.0alpha9

anybody’s picture

It's unbelievable. This critical issue exists since > 2 years and the maintainers just don't care? I think they must have missed this issue. Going to contact them via PM.

@Nixou could you please provide the patch as MR to make it easier to review and merge for the maintainers?

Thanks! :)

anybody’s picture

Thanks @omar_emailat - still this are separate issues. The frontend should never wait for the response, but run async, was written above.

anybody’s picture

Bumping this major issue.

damienmckenna’s picture

Title: The page freezes while the Real-Time SEO module runs script. » The page freezes while the Real-Time SEO module runs script
Issue tags: +Starshot
anybody’s picture

Issue summary: View changes
Status: Needs review » Needs work

Next step should be to prepare a MR from the latest patch. This is still horrible to use, waiting for the UI.

For that reason, I'd suggest adding a note to the description of the new setting:

+    $form['auto_refresh']['auto_refresh_seo_result'] = [
+      '#type' => 'checkbox',
+      '#title' => $this->t('Enable auto refresh of the Real Time SEO widget result'),
+      '#description' => $this->t('You can use this setting to allow or deny auto refreshing of the Real Time SEO widget results after a value of a form field is changed and a field focus is lost.'),
+      '#default_value' => $config->get('auto_refresh_seo_result'),
+    ];

like

Please note that this may cause UI delays, waiting for e.g. the Metatag values to become available to calculate the score

(A native speaker should improve the sentence).

And I guess this should have an update hook for existing installations to inform about the new option and keep the value enabled like before? (BC)

For new installations, I'd even propose to disable the setting by default for the reasons given and use an opt-in!

lrwebks’s picture

Assigned: Unassigned » lrwebks
lrwebks’s picture

Assigned: lrwebks » Unassigned
Status: Needs work » Needs review
grevil’s picture

Status: Needs review » Needs work

LGTM! Tested it and everything seems to be working as expected!

Added 2 more comments otherwise RTBC.

lrwebks’s picture

Assigned: Unassigned » lrwebks
Status: Needs work » Needs review
anybody’s picture

Status: Needs review » Needs work

Finally :)

anybody’s picture

Assigned: lrwebks » Unassigned
Status: Needs work » Reviewed & tested by the community

Perfectly fine now @lrwebks! RTBC from my side, thank you!!

  • kingdutch committed 6dccb166 on 8.x-2.x
    Issue #3008802 by anybody, knyshuk.vova, lrwebks, the_turk, flefle,...

  • kingdutch committed 48553703 on 8.x-2.x
    Issue #3008802 by anybody, knyshuk.vova, lrwebks, the_turk, flefle,...
kingdutch’s picture

Status: Reviewed & tested by the community » Fixed

I've been hoping for the past time that I'd find the time to fully update the Real-Time SEO module to the now released version of the Yoast SEO library so that we could move to webworkers and fix this issue. However, unfortunately that has required more time (and a better development set-up then I currently have available).

Given that the first release of Drupal CMS is around the corner and the Real-Time SEO module will be part of it, I'm adding the button and tagging a stable release. However, I do hope that in a future release we can once again remove the button and go back to "Real-Time" while preserving a smooth experience :)

While merging I've split this issue in two. One to refactor the controller into a SettingsForm and the other to introduce the actual change with the new setting. I also fixed some comments to use more inclusive language.

Thanks for your contributions everyone!

anybody’s picture

Hi and thank you so much @kingdutch for taking the time for this project! We've been waiting years for this to be fixed and never used the project because of the broken state of this issue.

Reading the comments and the MR, I think we should open a follow-up to also fix the JS-side of this issue.
The root cause here is blocking JavaScript and I think we might also want to remove jQuery?

The new option gives us the opportunity to disable the auto-refresh and makes the module usable again, but to have the functionality fixed, the JS needs to be corrected.

Do you agree? Should we open a follow-up for replacing jQuery by Vanilla JS and remove this blocking implementation combined?

kingdutch’s picture

Hey Anybody,

Yes I think that follow-up would be #2992481: Update YoastSEO JS to recent version. The newest release for the Yoast SEO library which finally came somewhere last year moves most of the processing to a webworker and keeps only the UI updates on the main thread. So that ensures that even if the server needs a bit more time we're not blocking.

My 5 year ago developer idea was to do that update with an overhaul of the widget itself and move that to React so that there's fewer event listeners and a more linear "Updated data comes in" -> "Render UI element top down" approach. One of the features that that should enable in the future is multiple keywords at the same time. However, I think that's a much larger undertaking so it makes sense to refocus the update issue to moving to the newest version as-is and seeing if we can only make smaller improvements to the existing widget, like replacing jQuery with vanilla JS.

stefan.korn’s picture

I suppose this addresses #3067487: Allow configuring of manual checking per field as well (using a site wide setting instead of form widget setting though). Maybe maintainers should decide whether to close #3067487: Allow configuring of manual checking per field now as a duplicate or not.

anybody’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.