Skip to content

Comments Block: Add blockGap, layout support, and default padding controls - #79477

Open
dhruvikpatel18 wants to merge 1 commit into
WordPress:trunkfrom
dhruvikpatel18:feat/add-comments-blockgap
Open

dhruvikpatel18 wants to merge 1 commit into
WordPress:trunkfrom
dhruvikpatel18:feat/add-comments-blockgap

Conversation

@dhruvikpatel18

@dhruvikpatel18 dhruvikpatel18 commented Jun 24, 2026 •

Copy link
Copy Markdown
Member

What?

Closes #71975

Adds blockGap, layout (inner blocks use content width), and default padding controls to the core/comments block, bringing it to parity with core/group as a layout container.

Why?

The core/comments block is a container that holds several comment-related inner blocks, but unlike core/group it was missing:

  • blockGap support, no way to control spacing between inner blocks
  • layout support, no "Inner blocks use content width" option
  • Default UI controls for padding, padding existed as a support but wasn't enabled by default in the sidebar

This made core/comments a second-class container compared to core/group, limiting layout flexibility for theme authors and site editors.

Testing Instructions

  1. Open a post or page in the site editor or block editor.
  2. Insert a Comments block.
  3. Open the block inspector sidebar.

blockGap:
4. Under Dimensions, confirm a Block spacing (blockGap) control is now visible and enabled by default.
5. Adjust the value, verify the spacing between inner comment blocks updates accordingly in the editor and on the frontend.

Default padding:
6. Under Dimensions, confirm the Padding control is visible and enabled by default (no need to click the "+" to add it).
7. Set a padding value and verify it applies correctly.

Inner blocks use content width (layout):
8. Under Layout in the sidebar, confirm the "Inner blocks use content width" toggle is present.
9. Enable it, verify inner blocks respect constrained/wide/full-width sizing.

Screenshots or screencast

Screen.Recording.2026-06-24.at.2.33.56.PM.mov

Summary by CodeRabbit

  • New Features
    • The Comments block now supports layout controls, including sizing for child blocks.
    • Added padding and block-gap spacing controls, enabled by default.

@github-actions

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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @EldarAgalarov.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

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

Unlinked contributors: EldarAgalarov.

Co-authored-by: dhruvikpatel18 <dhruvik18@git.wordpress.org>

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

@github-actions

Copy link
Copy Markdown

🤖 PR meta 🤖

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 6525977d-50a1-43ab-86dc-3cbad838f3a3

📥 Commits

Reviewing files that changed from the base of the PR and between 2d02cc8 and 5df49e0.

📒 Files selected for processing (5)
  • docs/reference-guides/core-blocks/README.md
  • packages/block-library/src/comments/README.md
  • packages/block-library/src/comments/block.json
  • packages/block-library/src/comments/deprecated.js
  • packages/block-library/src/comments/edit/index.js

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The Comments block adds padding and block-gap controls, layout support for sizing child blocks, and editor wiring for layout. A new v2 deprecated definition saves inner blocks unless its legacy attribute is true.

Changes

Comments block support

Layer / File(s) Summary
Configure and apply block support
packages/block-library/src/comments/block.json, packages/block-library/src/comments/edit/index.js, packages/block-library/src/comments/README.md, docs/reference-guides/core-blocks/README.md
The block enables padding and block-gap controls and layout support for sizing child blocks. The editor passes layout to inner blocks. Both documentation files list the layout support.
Register deprecated block definition
packages/block-library/src/comments/deprecated.js
The new v2 deprecated definition saves inner blocks unless legacy is true. The default export registers v2 before v1.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to 5df49

The change adds Comments layout and spacing controls while retaining legacy serialization support. No actionable merge-blocking risk is established; merge after normal checks pass.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 5df49

The change reuses existing editor and save mechanisms and retains a compatibility path for older Comments blocks. No new privilege or content-access path was identified, but frontend handling of persisted attributes and interrupted save recovery were not fully verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated expansion concerns presentation of Comments blocks and their nested content wherever the block is used. The inspected paths do not establish new access to comment records, another tenant, credentials or privileged services; frontend attribute handling remains incompletely verified.

Trust Boundaries and Controls

  • inferred — The newly forwarded block attribute crosses an existing package API boundary, not a demonstrated new identity or authorization boundary. Existing editor context and save helpers remain in the path, but their use alone does not prove server-side sanitization of persisted attributes.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (3 skipped: 3 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: block gap support, layout support, and default padding controls for the Comments block.
Linked Issues check ✅ Passed The changes satisfy the coding requirements in [#71975]. block.json enables spacing.padding and spacing.blockGap, and enables both controls by default. block.json also enables `layout.allowSiz…
Out of Scope Changes check ✅ Passed The changes remain within [#71975]. The deprecated block definition preserves older Comments block behavior while adding the required version handling. The documentation updates describe the new layou…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch feat/add-comments-blockgap
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block library /packages/block-library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core/comments: Missing blockGap and contentWidth options, no global padding

1 participant