-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[Block Library - Query Pagination] Simplify pagination blocks #37125
Conversation
Size Change: +259 B (0%) Total Size: 1.11 MB
ℹ️ View Unchanged
|
@matiasbenedetto started some of this work in #37113 |
$placholder_attributes = get_block_wrapper_attributes( | ||
array( | ||
'aria-hidden' => 'true', | ||
'style' => 'visibility:hidden;', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why an inline style written in PHP is better than a CSS rule. I'm wondering why do you prefer this?
$placholder_attributes = get_block_wrapper_attributes( | ||
array( | ||
'aria-hidden' => 'true', | ||
'style' => 'visibility:hidden;', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding PHP logic to add styles doesn't seem to be the best option. I think it adds complexity and makes the elements harder to style with themes.
The changes on the logic to output the placeholder, the link, or nothing are not working well with this PR on some edge cases. As I previously mentioned we need to consider 2 conditions in order to know what we need to render. Example for the Previous component?:
With these changes, we are rendering Previous and Next links for example when there are no contents to paginate and that's an error. Examples: |
Summarizing the concerns that motivated this PR:
|
👋 - thanks for reviewing @matiasbenedetto !
1 and 2 needs to be fixed, but this PR was mostly about the new added logic there, which seemed to me at first quite complex. Personally the concept of adding an extra element (hidden wrapper) for design purposes seems a bit odd to me and I'm not really sure if this should be added in the first place. Would another kind of layout be a better fit for these blocks (even if it doesn't exist yet like Then I noticed that especially in the case of Having said that, the example you shared about the Because of that bug in this use case (custom query with no results) it was possible to go to a non-existing page and see a similar wrong link for Actually I'm going to close this PR for now and will comment in the original PR with parts of this response and my thoughts. |
Recently in this PR: #36681, there were some changes to Query Pagination blocks which aimed to render a hidden placeholder element for design purposes, if I understand correctly for now.
I'm not sure if the problem could be solved with another
layout
(other than the currently usedflex
) but for now we should at least try to simplify the code to achieve this.There are some things that need to be investigated:
layout
abstractionnext/previous
pagination blocksThe PR's description will be updated as I'm looking through the needed changes.
--cc @MaggieCabrera @scruffian @matiasbenedetto