Post Comments block: Enqueue comment-reply script #40366
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
On the frontend, inline the Post Comments block's comment submission form in the position of the "Reply" link that the user clicked.
Note how the comment form opens inline (in the position where the comment will show up, i.e. after the last child of the comment we're replying to).
This means that we're changing the behavior of themes that have been using the Post Comments block -- such as Twenty Twenty Two. We should consult with theme authors if this is okay (or if possibly theme authors might even have implicitly relied on the previous behavior, and if there's any potential for breakage).
Why?
Feature parity with previous WordPress Comments (prior to FSE). FWIW, the same behavior was implemented in #40268 for the Comments Query Loop block (which is kind of a more modular successor to the Post Comments block.)
How?
By enqueuing WordPress'
comment-reply.jsscript.What else?
We might want to enqueue only under some conditions: #40268 (comment)
Testing Instructions
gutenberg/packages/block-library/src/post-comments/block.json
Line 37 in 54fd3bf