Skip to content

Editorial Notes: Fix block selection when Show Template is active - #1053

Merged
dkotter merged 9 commits into
WordPress:developfrom
Infinite-Null:fix/editorial-notes-show-template-blocks
Sep 28, 2026
Merged

dkotter merged 9 commits into
WordPress:developfrom
Infinite-Null:fix/editorial-notes-show-template-blocks

Conversation

@Infinite-Null

@Infinite-Null Infinite-Null commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

What?

Closes: #1052

Ensures Editorial Notes analyzes the actual post and page content blocks instead of the surrounding template blocks when the "Show template" option is enabled in the WordPress block editor.

Why?

When "Show template" is turned on in WordPress, the editor wraps the post inside template elements (such as the Header, Post Title, Featured Image, and Footer). Editorial Notes was fetching blocks from the root of the template rather than the post content itself. As a result, it only reviewed the template blocks (e.g., 4 blocks) instead of the actual post blocks (e.g., 14 blocks).

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 4.6
Used for: Validating bug, suggesting a fix.

Testing Instructions

  1. Enable the Editorial Notes experiment under AI > Experiments.
  2. Open or create a post with several paragraphs, headings, and lists.
  3. With "Show template" turned off, click Generate Editorial Notes in the Post sidebar. Confirm that it reviews all blocks in the post.
  4. In the editor header/options, enable Show template.
  5. Click Generate Editorial Notes again.
  6. Verify that it still reviews the full count of post blocks, rather than just the template blocks.

Screenshots or screencast

Before After
Screenshot 2026-09-21 at 6 10 48 PM Screenshot 2026-09-21 at 6 16 37 PM

Changelog Entry

Fixed - Editorial Notes only reviewing template blocks when "Show template" mode is enabled in the block editor.

Open WordPress Playground Preview

@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.87%. Comparing base (5d0efa5) to head (70ecc12).
⚠️ Report is 8 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #1053      +/-   ##
=============================================
+ Coverage      80.72%   80.87%   +0.15%     
  Complexity      2998     2998              
=============================================
  Files            124      124              
  Lines          11978    11987       +9     
=============================================
+ Hits            9669     9695      +26     
+ Misses          2309     2292      -17     
Flag Coverage Δ
unit 80.87% <ø> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jeffpaul jeffpaul added this to the Future Release milestone Sep 21, 2026
@Infinite-Null
Infinite-Null marked this pull request as ready for review September 22, 2026 14:19
@Infinite-Null
Infinite-Null requested a review from a team September 22, 2026 14:19
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Infinite-Null <ankitkumarshah@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Comment thread src/experiments/editorial-notes/hooks/useEditorialNotes.ts Outdated
Comment thread src/experiments/editorial-notes/hooks/useEditorialNotes.ts Outdated
@dkotter dkotter modified the milestones: Future Release, 1.4.0 Sep 22, 2026

@yogeshbhutkar yogeshbhutkar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a few minor nits:

Comment thread src/experiments/editorial-notes/hooks/useEditorialNotes.ts Outdated
Comment thread src/experiments/editorial-notes/hooks/useEditorialNotes.ts Outdated
Comment thread src/experiments/editorial-notes/hooks/useEditorialNotes.ts Outdated
Comment thread tests/e2e/utils/helpers.ts Outdated
@Infinite-Null

Copy link
Copy Markdown
Contributor Author

Hi @dkotter and @yogeshbhutkar, I've addressed all the feedback. Can you please have a look at your convenience. Thank you!

Comment thread src/experiments/editorial-notes/components/EditorialNotesPlugin.tsx Outdated
Comment thread src/utils/blocks.ts Outdated
Comment thread src/utils/blocks.ts Outdated
Comment thread src/utils/blocks.ts Outdated
Comment thread src/utils/blocks.ts Outdated
Comment thread src/utils/blocks.ts Outdated
Comment thread src/utils/blocks.ts Outdated
Comment thread src/experiments/editorial-notes/hooks/useEditorialNotes.ts Outdated
Comment thread tests/e2e/specs/experiments/editorial-notes.spec.js Outdated
Comment thread src/utils/blocks.ts Outdated

@yogeshbhutkar yogeshbhutkar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests well. Looping @dkotter for another look.

@Infinite-Null

Copy link
Copy Markdown
Contributor Author

Just an FYI, I have added a test that is: Displays error notice when post content block is missing from the template for wider test coverage.

cc: @yogeshbhutkar @dkotter

@dkotter
dkotter merged commit 9538821 into WordPress:develop Sep 28, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editorial Notes: Only reviews template blocks instead of post content when "Show template" is enabled

4 participants