Skip to content
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]: Try rendering hidden element when no next/previous link exists #40851

Closed
wants to merge 3 commits into from

Conversation

ntsekouras
Copy link
Contributor

@ntsekouras ntsekouras commented May 5, 2022

What?

Attempt to fix: #34997
Alternative of:#40553 and #36681.

I'm still not sure if we want to render an element for design purposes only and I think that the proper approach would be a new layout or some layout controls, that do not exist right now..

We need to weight the pros and cons of such approach and I haven't done all the testing and considered everything yet. But I acknowledge that this is a very common use case that needs to be handled somehow.

I started exploring a layout grid approach, but it needs exploration and if I come up with something good, I'll open a PR for that.

How?

In this PR I render a hidden element only if there was no link for Query Pagination Next/Previous and only if the parent Query Pagination block has justification content center or space-between.

@ntsekouras ntsekouras added the [Block] Query Pagination Affects the Query Pagination Block - used for pagination within the Query Loop Block label May 5, 2022
@ntsekouras ntsekouras self-assigned this May 5, 2022
@ntsekouras ntsekouras force-pushed the try/query-pagination-render-hidden-element branch from f8c45a3 to f927521 Compare July 28, 2022 09:43
@ntsekouras
Copy link
Contributor Author

ntsekouras commented Jul 28, 2022

The problem in this PR for now is that if we have no results it will still display the Query Pagination blocks with two visibility:hidden; We could try to add logic to detect this here: https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/query-pagination/index.php#L17 and see how complex it becomes and if it's worth it. If we add similar logic to previous/next blocks the complexity is quite big and has been explored before.


--edit: I pushed a rough POC to handle the above issue.

@ntsekouras
Copy link
Contributor Author

Closing in favor of #42764

@ntsekouras ntsekouras closed this Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Query Pagination Affects the Query Pagination Block - used for pagination within the Query Loop Block
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query Pagination: Control the layout when next/previous buttons are not displayed
1 participant