Yoast / wordpress-seo

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

TypeError: this.treeAdapter.getAttrList is not a function #14067

Open bobbingwide opened 4 years ago

bobbingwide commented 4 years ago

Please give us a description of what happened.

I keep on seeing errors in the Chrome Console. image

Please describe what you expected to happen and why.

I'm documenting blocks at blocks.wp-a2z.org. Every now and then, when a block doesn't appear to be working properly, I look in the console and see these messages. For many messages it's difficult to tell what caused them, but for these it's pretty obvious. I'd rather not see the messages.

I've been seeing these messages for months. When I took the screenshot I was using the latest version of WordPress, WordPress SEO 12.6.2 and Gutenberg 7.0.0 The messages are still there in 12.7 ( analysis-1270.min.js:21 ) and 12.7.1 ( analysis-1271.min.js:21 )

The problem seems to be related to blocks containing SVG tags

<!-- wp:oik-block/blockicon -->
<div class="wp-block-oik-block-blockicon"><span class="editor-block-icon block-editor-block-icon"><svg aria-hidden="true" role="img" focusable="false" class="dashicon dashicons-block-default" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 20 20"><path d="M15 6V4h-3v2H8V4H5v2H4c-.6 0-1 .4-1 1v8h14V7c0-.6-.4-1-1-1h-1z"></path></svg></span></div>
<!-- /wp:oik-block/blockicon -->

How can we reproduce this behavior?

  1. Edit some content
  2. Open the Chrome inspector.
  3. Insert a custom HTML block
  4. Paste the contents below
    <svg aria-hidden="true" role="img" focusable="false" class="dashicon dashicons-block-default" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 20 20"><path d="M15 6V4h-3v2H8V4H5v2H4c-.6 0-1 .4-1 1v8h14V7c0-.6-.4-1-1-1h-1z"></path></svg>
  5. Look in the console log for errors.

Technical info

Used versions

bobbingwide commented 4 years ago

I believe this is fairly reproducible.

image

Djennez commented 4 years ago

Hi @bobbingwide and thanks for your report! I can confirm this is an issue, as we have a similar issue on our internal bugtracker. This thread will stay open as a public-facing tracker.

After reproducing this, I do observe that It does not seem to directly affect functionality of the analysis or the blocks of the post. Can you confirm that it is purely the JavaScript error, and that the rest of the blocks and analysis thereof is is not impacted?

bobbingwide commented 4 years ago

Can you confirm that it is purely the JavaScript error, and that the rest of the blocks and analysis thereof is is not impacted?

That’s a good question. What would you expect to happen? Here are two screen captures of a very simple block example. The content difference is the block icon block.

Should the analysis ignore the SVG, which is just decoration? 562B11DA-1A2E-4EE8-A52F-E6380ED51FCF

E9D1D6A5-735D-40F9-8630-1F82CBBC2016

Djennez commented 4 years ago

Hey @bobbingwide, I am running 13.0 and I can't reproduce this error anymore. I am also not seeing any impact on the analysis. Can you confirm from your end if this is fixed?

bobbingwide commented 4 years ago

I am running 13.0 and I can't reproduce this error anymore. Ditto. I no longer see the TypeError message.

I am also not seeing any impact on the analysis BUT I still see changes to the figures reported in the Readability Analysis

With my block and the custom HTML block the figures that are different are Passive voice, Transition words and Flesch reading ease. I get the same difference with both my block and custom HTML.

Analysis results With the SVG Without the SVG
Passive voice 37.5% 50%
Transition words 12.5% 16.7%
Flesch reading 64.9 63

Additional Notes

In my original example the viewbox attribute name was all lower case. It needs to be viewBox.

As an aside, I'm now seeing another message in the console

[Violation] Avoid using document.write(). 

It appears to be coming from Gutenberg.