-
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
Try: "No results" block container for the query block #38806
Conversation
Size Change: +2.77 kB (0%) Total Size: 1.21 MB
ℹ️ View Unchanged
|
This PR looks sane enough to me but would be nice to create some type of custom message in the Block. Something like this? "No Results Block Could you use wordpress/components Placeholder for this? After this accessibility fix was merged, I wonder if this would at least be better than nothing for now. https://github.com/WordPress/gutenberg/tree/trunk/packages/components/src/placeholder Just a thought... |
dca5cbd
to
c6af466
Compare
I experimented a bit with the placeholder component but I was not able to combine it with an inserter. I think that displaying a default text that the user can update is the easiest alternative to start with. |
Makes sense to me... If someone wants to change the message and/or add extra blocks etc, all they have to do is click on it in the editor and they'll be able to change it. I went ahead and rebased the PR to bring it up to speed 👍 |
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.
Overall the code makes sense. Tested and does what is expected 👍
Some notes:
- We should write a better description for the block
- I believe it would be best to add this block to the default template for the query. If users don't want it and it's there they can remove it, but if they want it and it's not there, looking for it and manually adding it will be harder (and will probably look like a bug to a lot of people)
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.
The code is clean and looks good.
Does what it's supposed to do.
Doesn't introduce any backward-compatibility issues for existing instances, has a placeholder which is explanatory and allows users to add what they want.
Overall this looks good to me and fixes the issue.
Great work @carolinan!
"name": "core/query-no-results", | ||
"title": "No results", | ||
"category": "theme", | ||
"description": "Contains the block elements used to render content when no query results are found.", |
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 have to spend a few seconds re-reading this description in order to understand what I need to do, so IMO it's sub-optimal.
However, it is consistent with the comment-template and post-template blocks which use similar wording, so if this changes it would ideally also change in other blocks as well - so not something specific to this PR.
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 think "Contains the content shown when no query results are found" would convey the same meaning in fewer words. Maybe even just "The content shown when no query results are found" would work.
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 like the first suggestion, but I would like the related block descriptions to have a "simpler" language, and not only this new block.
* Try: "No results" block container for the query block * Linting and fixtures * Update docs * Add content to the default paragraph * Update fixtures, try new block description * Add block to query block variations, update placeholder text Co-authored-by: Ari Stathopoulos <[email protected]>
Description
Adds a container block in which you can place any other blocks, that are displayed when the query (loop) has no results.
See #36609, #27302
This is a simplified version that:
Alternative: #36225
Challenges:
How to explain how the block can be used in the query loop.
Test the many different scenarios (for example, if the query is set to only include sticky posts, and the install has no sticky posts, both the non-sticky posts and the "no results" message is shown, and this is a bug).
Testing Instructions
Screenshots
Types of changes
New feature
Checklist:
*.native.js
files for terms that need renaming or removal).