Skip to content

Comments Pagination: Remove unwanted bottom margin from links #70360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

vk17-starlord
Copy link
Contributor

@vk17-starlord vk17-starlord commented Jun 9, 2025

Description

This pull request addresses Issue #62114 by removing the unwanted bottom margin from the Comments Pagination block links (Comments Next Page, Comments Previous Page, and Comments Page Numbers). The default margin created misalignments in themes and could not be easily overridden via Global Styles, theme.json, or custom CSS.

What’s changed

  • Removed the default bottom margin from the pagination links in the Comments Pagination block by targeting the .wp-block-comments-pagination container and its direct child link elements.
  • Ensured that the fix is scoped specifically to the Comments Pagination block to avoid unintended side effects on other components.

Rationale

  • The bottom margin was not necessary for the block's layout and created consistent styling issues across themes.
  • This update brings alignment with user expectations and improves the visual consistency of comment pagination within block themes.

How to test

  1. Add the Comments Pagination block to a post or template.
  2. View the block on the frontend and in the editor.
  3. Confirm that the unwanted bottom margin is removed from the pagination links and that the block aligns correctly with surrounding elements.

Related

Copy link

github-actions bot commented Jun 9, 2025

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: vk17-starlord <vineet2003@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: cbravobernal <cbravobernal@git.wordpress.org>
Co-authored-by: iamtakashi <iamtakashi@git.wordpress.org>

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

@vk17-starlord vk17-starlord changed the title Fix/unwanted margin bottom comments pagination Comments Pagination: Remove unwanted bottom margin from links Jun 9, 2025
@t-hamano t-hamano added [Block] Comments Pagination Affects the Comments Pagination Block [Type] Enhancement A suggestion for improvement. labels Jun 9, 2025
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

The fundamental problem isn't that the block has margins applied by default, but that we can't override the default margins using the global styles. Therefore, simply changing the bottom margin value to 0 doesn't solve this fundamental problem.

I believe the ideal approach is to remove ALL margin styles. See #64874

Note that we need to update editor.scss as well as style.scss.

…ins to let global styles override the block styles
@vk17-starlord
Copy link
Contributor Author

Hey @t-hamano, thank you so much for pointing that out! 🙏

I've gone ahead and cleaned up all the margin styles specifically tied to the comments pagination block. Now, the pagination margins are fully controlled via global styles—making it much easier to override and maintain consistency across the site. Your feedback really helped streamline this—appreciate it!

Here’s the global style I’ve set for the comments pagination previous link.

image

And here’s how it now reflects on the actual page with the global styles successfully overriding the block-level margins:

image

@t-hamano
Copy link
Contributor

Thanks for the update!

One last thing, we should be able to remove this margin-right: 0 too: https://github.com/WordPress/gutenberg/pull/70360/files?diff=unified&w=0#diff-9f2d12fce591822d40b090e53e042620657f7efd4a0aa2106acc9f00a35edd8cR19-R22

@vk17-starlord
Copy link
Contributor Author

@t-hamano - I've removed margin-right property too !!! Thanks for your feedback.

@t-hamano
Copy link
Contributor

t-hamano commented Jun 11, 2025

@vk17-starlord I don't think we can delete font-size:inherit here 😅

image

@vk17-starlord
Copy link
Contributor Author

@t-hamano Apologies for accidentally removing font-size: inherit in the earlier commit. I've added it back in the latest update.
Thank you for your feedback!

Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines -11 to -13
&.block-editor-block-list__layout {
margin: 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Memo: The main purpose of this PR is to remove the default margin from the three child blocks (Comments Next Page, Comments Previous Page, and Comments Page Numbers), but note that this part is related to the parent Comment Pagination block.

Some default themes define margins for the Comment Pagination block, but the zero margin takes precedence, and the styles are not applied correctly:

image

This PR will allow the editor to correctly apply the margin provided by the theme to the comment pagination block itself as well as the three child blocks.

@t-hamano
Copy link
Contributor

Unfortunately, it seems that recent changes in the core are causing E2E tests to fail. Let's wait until that issue is resolved.

@t-hamano
Copy link
Contributor

Unfortunately, it seems that recent changes in the core are causing E2E tests to fail. Let's wait until that issue is resolved.

This is a known issue and is not related to this PR, so let's merge this PR. See https://wordpress.slack.com/archives/C02QB2JS7/p1749712750681339

@t-hamano t-hamano merged commit aae6dee into WordPress:trunk Jun 14, 2025
59 of 61 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.1 milestone Jun 14, 2025
chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
…ess#70360)

* fix: remove bottom margin from comments pagination numbers

* fix: remove unnecessary blank line in comments pagination styles

* fix: clean up comments pagination styles by removing unnecessary margins to let global styles override the block styles

* fix: remove unnecessary  margin styles from comments pagination component

* fix: add missing styles for comments pagination component

Co-authored-by: vk17-starlord <vineet2003@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: cbravobernal <cbravobernal@git.wordpress.org>
Co-authored-by: iamtakashi <iamtakashi@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Comments Pagination Affects the Comments Pagination Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Comments Pagination: Remove unwanted bottom margin from links
2 participants