SVG elements in gutenberg cause Yoast readability error
-
When inserting a block that includes an SVG element, Yoast throws a console error:
Yoast SEO and readability analysis: An error occurred during the building of the tree structure used for some assessments.
TypeError: this.treeAdapter.getAttrList is not a function
at a.value (wp-seo-analysis-worker-1150.min.js:21)
at a.value (wp-seo-analysis-worker-1150.min.js:21)
at a.value (wp-seo-analysis-worker-1150.min.js:21)
at a._runParsingLoop (wp-seo-analysis-worker-1150.min.js:21)
at a.value (wp-seo-analysis-worker-1150.min.js:21)
at e.parseFragment (wp-seo-analysis-worker-1150.min.js:21)
at Object.e.default [as html] (wp-seo-analysis-worker-1150.min.js:21)
at a.value (wp-seo-analysis-worker-1150.min.js:21)
at a.<anonymous> (wp-seo-analysis-worker-1150.min.js:17)
at v (wp-seo-analysis-worker-1150.min.js:17)You can replicate this bug with a simple block that outputs an SVG:
const { __ } = wp.i18n; const { registerBlockType } = wp.blocks; const SVGBlock = () => ( <svg xmlns="https://www.w3.org/2000/svg" viewBox="0 0 101.82 101.82" > <path d="M50.912-.003l50.91 50.912-50.91 50.91L0 50.91z"/> </svg> ); registerBlockType( 'test/svg-bug', { title: __( 'svg bug' ), description: __( 'Yoast doesn\'t like this' ), icon: 'excerpt-view', category: 'common', attributes: {}, edit: SVGBlock, save: SVGBlock } );
- The topic ‘SVG elements in gutenberg cause Yoast readability error’ is closed to new replies.