Skip to content

Invalid subheading distribution warning with subheading line break and 196+ word #22785

@amboutwe

Description

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

Please give us a description of what happened

When a subheading contains a line break and 196+ words, the subheading distribution warning occurs incorrectly.

Copied from archived repo as issue still exists. See Yoast/YoastSEO.js#2161

To Reproduce

Step-by-step reproduction instructions

  1. Create new post with content sample below (code view).
  2. Check Readability Analysis. See warning about subheading.
  3. Remove the word six from the paragraph above 'Section Two'. Warning goes away.
  4. Add the word six back. Warning appears again.
  5. Switch to code view
  6. Remove the line break from 'Section One With Line Break'. Warning goes away.
  7. Add line break back. Warning appears.

Expected results

No warning

Actual results

Warning appeared

Subheading distribution: 1 section of your text is longer than 300 words and is not separated by any subheadings. Add subheadings to improve readability.

Screenshots, screen recording, code snippet

examplecode.txt

Image Image Image

Technical info

  • If relevant, which editor is affected (or editors):
  • Block Editor
  • Classic Editor

Used versions

  • Device you are using: Desktop
  • Operating system: Win11
  • PHP version: 8.4.5 (Supports 64bit values)
  • WordPress version: 6.9
  • WordPress Theme: Twenty Twenty-Three (twentytwentythree) v1.6
  • Yoast SEO version: 26.5
  • Classic Editor plugin version: 1.6.7 (not required; just tested to confirm it happens in both classic and block editors)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions