Skip to content

Conversation

@ockham
Copy link
Contributor

@ockham ockham commented Apr 14, 2022

What?

On the frontend, inline the Post Comments block's comment submission form in the position of the "Reply" link that the user clicked.

Before After
post-comments-before post-comments-after

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.js script.

What else?

We might want to enqueue only under some conditions: #40268 (comment)

Testing Instructions

  1. The Post Comments block is currently hidden from the inserter. You need to remove the following line (and rebuild Gutenberg) in order to show it:
  2. Go to the Site Editor and edit the Single page template.
  3. Insert the block named "Post Comments (deprecated)". (Don't worry about the somewhat ugly placeholder it inserts for now.)
  4. Save the template, and go to your site's frontend.
  5. Navigate to a single post, and add a comment.
  6. Reply to that comment. Note that the comment form shows up inline, and that the page is scrolled to show that comment at the top of your browser window after submitting the comment.

@ockham ockham added Needs Design Feedback Needs general design feedback. [Block] Comment Template Affects the Comment Template Block labels Apr 14, 2022
@ockham ockham requested a review from ajitbohra as a code owner April 14, 2022 21:03
@ockham ockham self-assigned this Apr 14, 2022
@ockham
Copy link
Contributor Author

ockham commented Apr 22, 2022

I've consulted with themers @scruffian and @MaggieCabrera to make sure that this behavioral change won't have any negative impact; they couldn't think of any, so I'll proceed to merge this 😄

@ockham ockham merged commit bf3ce13 into trunk Apr 22, 2022
@ockham ockham deleted the update/post-comments-inline-form branch April 22, 2022 10:40
@github-actions github-actions bot added this to the Gutenberg 13.2 milestone Apr 22, 2022
Copy link
Contributor

@cbravobernal cbravobernal left a comment

Choose a reason for hiding this comment

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

LGTM!

@ndiego ndiego added the Backport to WP 6.9 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Apr 25, 2022
@adamziel adamziel removed the Backport to WP 6.9 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Apr 25, 2022
@georgeh georgeh added the [Type] Enhancement A suggestion for improvement. label May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Comment Template Affects the Comment Template Block Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants