Fix: Pagination misalignment on first and last pages in Query Pagination Block#70607
Fix: Pagination misalignment on first and last pages in Query Pagination Block#70607coderGtm wants to merge 1 commit intoWordPress:trunkfrom
Conversation
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Hey @coderGtm, I have tested this PR. It correctly resolves the issue with pagination layout when using the "space between" setting. The pagination block now maintains a consistent layout across all pages, ensuring the page numbers remain centered even on the first and last pages. Environment: WordPress Block Editor (Gutenberg) Scope of Change
Steps to Reproduce
Expected Results
Actual Results
Before and After Summary
ComparisonBefore FixLayout keeps shifting for the numbering for first and last page.
After FixLayout is consistent for the numbering for first and last page. |




What?
Closes #69580
This PR fixes that issue by keeping the page numbers centered even on first and last pages.
Why?
This ensures consistent and expected UX for users as the sudden drastic shift in position of the page numbers while on first and last pages can be quite confusing to the users.
How?
A few approaches were discussed in the linked issue but each had their gotchas. Initially I was going to solve it using one of the approaches (rendering empty element) but that would have caused problem in future if border styling is introduced. Somehow while inspecting the styles of the elements, I came up with this solution to conditionally apply margin to the page numbers using only CSS.
So basically, I wrote the CSS selectors for when there will be no previous/next buttons and accordingly applied
autoinline-margin in the corresponding directions.Testing Instructions
Screenshots or screencast
screencast.mp4