Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.77k stars 891 forks source link

Disabling Guttenberg causes readability analysis errors with Shortcode from "Easy forms for Mailchimp" #13563

Open magapatalogikaa opened 5 years ago

magapatalogikaa commented 5 years ago

Please give us a description of what happened.

I use "Disable Gutenberg, so that styles and scripts are not loaded in the frontend because I do not use Gutenberg blocks, I encountered a "bug" with Yoast SEO if I disable Gutenberg and use the Plugin "Easy Forms for Mailchimp". The error appears is in the backoffice, in Google Chrome Console. This is the error I see: «Yoast SEO and readability analysis: An error occurred during the building of the tree structure used for some assessments. TypeError: Cannot read property 'startOffset' of undefined at analysis-1220.min.js:21 at Array.filter () at analysis-1220.min.js:21 at analysis-1220.min.js:21 at Array.forEach () at e.default (analysis-1220.min.js:21) at analysis-1220.min.js:21 at analysis-1220.min.js:21 at e.value (analysis-1220.min.js:10) at analysis-1220.min.js:10 » I tested this with Twenty Ninteen and the error shows if I have "Disable Gutenberg" and "Easy Forms for Mailchimp" active. I will be reporting this to "Easy Forms for Mailchimp" also.

So the problem seems to be when disabling Guttenberg and also with the plugin "Easy forms for mailchimp" Active.

Appears that "Easy Forms for Mailchimp" shortcode interferes with SEO Readability Analysis without the Gutenberg active. Which is very "weird". Only in pages where the shortcode for the form is included. Like this : [yikes-mailchimp form="1"] The problem at first seemed to be the Shortcode and not the plugin, but I tried to include a Contact Form 7 Shortcode, and the error disappears.

I do not use Readability analysis, so I would like to know: 1 - Is this a big problem? Does not seem to be. 2 - Is this something Yoast SEO can fix? Or is this something for "Easy Forms for Mailchimp" to fix? Or both. :-)

Please describe what you expected to happen and why.

I expect the readability analysis to work without any problems :-). It is a shortcode and it should be ignored or "read" as it should be for readability.

How can we reproduce this behavior?

  1. Install "Disable Gutenberg" and "Easy forms for Mailchimp"
  2. Create and Insert a "Form from Easy Forms for Mailchimp" in any page with the default theme (Twenty Nineteen)
  3. Watch for Google Chrome Console

Technical info

freddiemixell commented 5 years ago

Hey Yoast, I'm the maintainer of Easy Forms for Mailchimp I'm looking into this from my end as well but I'm going to comment here to stay up to date on any developments.

So far I have confirmed this bug:

Test 1: (With Gutenberg) WP: 5.2.3 and 5.3 Yoast WordPress: 12.2 (Only active plugin) PHP Version 7.2 WP Debug Scripts Constant Active

Errors:

Test 2: (With Gutenberg) WP: 5.2.3 and 5.3 Yoast WordPress: 12.2 Easy Forms for Mailchimp PHP Version 7.2 WP Debug Scripts Constant Active

Errors: Same as above.

Test 3: (Gutenberg Disabled) WP: 5.2.3 and 5.3 Yoast WordPress: 12.2 Easy Forms for Mailchimp Disable Gutenberg v 1.9 PHP Version 7.2 WP Debug Scripts Constant Active

Errors: (This is the full error I didn't want to post it multiple times.)

react-dom.js?ver=16.8.4:500 Warning: Unknown event handler property `onButtonClick`. It will be ignored.
    in li (created by Context.Consumer)
    in t (created by AnalysisResult__AnalysisResultBase)
    in AnalysisResult__AnalysisResultBase
    in Unknown (created by p)
    in ul (created by Context.Consumer)
    in t (created by AnalysisList__AnalysisListBase)
    in AnalysisList__AnalysisListBase (created by p)
    in p (created by t)
    in div (created by Context.Consumer)
    in t (created by Collapsible__StyledContainer)
    in Collapsible__StyledContainer
    in Unknown (created by t)
    in t (created by Context.Consumer)
    in t (created by ContentAnalysis__StyledCollapsible)
    in ContentAnalysis__StyledCollapsible (created by t)
    in div (created by Context.Consumer)
    in t (created by ContentAnalysis__ContentAnalysisContainer)
    in ContentAnalysis__ContentAnalysisContainer (created by t)
    in t (created by t)
    in t (created by ComponentWithDispatch)
    in ComponentWithDispatch (created by Context.Consumer)
    in WithDispatch(t) (created by ComponentWithSelect)
    in ComponentWithSelect (created by Context.Consumer)
    in WithSelect(WithDispatch(t)) (created by Context.Consumer)
    in div (created by Context.Consumer)
    in t (created by ReadabilityAnalysis__ReadabilityResultsTabContainer)
    in ReadabilityAnalysis__ReadabilityResultsTabContainer (created by Context.Consumer)
    in t (created by Connect(t))
    in Connect(t) (created by m)
    in o (created by s)
    in t (created by s)
    in s (created by m)
    in div
    in Unknown (created by t)
    in t (created by m)
    in SlotComponent (created by Context.Consumer)
    in Slot
    in Unknown
    in SlotFillProvider

I then decided to clone Yoast Step 1: composer install && yarn && grunt build Step 2 git checkout 12.2 Step 3: Added a form to a page. Upon the page changing they analysis tool gave the following errors.

I went into the node modules and added some console logs to see if I could see what was causing this and this is what I see.

calculateTextIndices.js

var elementsThatCanBeClosed = function elementsThatCanBeClosed(currentElement, openElements) {
    console.log(`Current Element ${currentElement}`); // I added these
    console.log(currentElement);
    return openElements.filter(function (el) {
        var endTag = el.location.endTag;
        return endTag.endOffset <= currentElement.location.startOffset;
    });
};
Current Element {
  "type": "Ignored",
  "sourceStartIndex": 0,
  "sourceEndIndex": 0,
  "_researchResult": {},
  "tag": "comment",
  "content": " dictate label visibility ",
  "tagName": "comment"
}

I hope this can help! Let me know if theres something I need to do on my end!

freddiemixell commented 5 years ago
FormattingElement {type: "label", attributes: {…}, sourceStartIndex: null, sourceEndIndex: null, textStartIndex: null, …}
attributes: {for: "yikes-easy-mc-form-1-FNAME", class: "FNAME-label "}
location: {startLine: 5, startCol: 14, startOffset: 238, endLine: 17, endCol: 18, …}
namespace: "http://www.w3.org/1999/xhtml"
parent: Paragraph {type: "Paragraph", sourceStartIndex: 0, sourceEndIndex: 0, _researchResult: {…}, textContainer: TextContainer, …}
sourceEndIndex: null
sourceStartIndex: null
tagName: "label"
textEndIndex: null
textStartIndex: 15
type: "label"
jofbe commented 4 years ago

I have the same error message, but with Beaver Builder being the only other active plugin, and having a default theme activated.

Yoast version: 12.8 Beaver Builder version: 2.3.0.3 WP version: 5.3.2

Also, when I open a page on the admin side, and click on the Launch Beaver Builder button, I get redirected to the page with the ?fl_builder parameter set, but the builder is not active. In the console I see two 404s (xxx-layout-draft.css and xxx-layout-draft.js), and an error, saying "Uncaught ReferenceError: FLBuilderLayout is not defined".

If I stay on the front end, and do a refresh, the error is gone, and the page builder is available. If I disable Yoast, the issue is gone.