wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

Wrong Duplicate h1 reported

Open peeke opened this issue 2 years ago • 1 comments

  • [x] I've read and understood the contribution guidelines.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened.

Using the yoastseo library, I ran a SEO analysis on a page containing a single <h1> tag. The <h1> tag is nested within a custom element. The analysis displays the following result:

Single title: H1s should only be used as your main title. Find all H1s in your text that aren't your main title and change them to a lower heading level!

There are no javascript errors reported in the browser console.

Please describe what you expected to happen and why.

I would expect yoastseo to find just one <h1>, regardless whether that <h1> is wrapped in a custom element or not.

How can we reproduce this behavior?

I've created a minimal reproduction case in Code Sandbox: https://codesandbox.io/s/yoast-seo-custom-element-bug-mlgosb

Technical info

  • If relevant, which editor is affected (or editors):
  • [ ] Classic Editor
  • [ ] Gutenberg
  • [ ] Classic Editor plugin
  • Which browser is affected (or browsers):
  • [x] Chrome
  • [x] Firefox
  • [x] Safari
  • [ ] Other

Used versions

  • WordPress version: not relevant, issue occurs using yoastseo outside of Wordpress
  • Yoast SEO version: yoastseo 1.91.0

peeke avatar Nov 23 '22 12:11 peeke