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
Make Archives Block display correct empty message #9419
Conversation
$archives | ||
) : sprintf( | ||
'<div class="%1$s">%2$s</div>', | ||
$classnames, |
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.
We are outputting an empty class on the frontend <div class="">No archives to show.</div>
. Should we use esc_attr( $class )
here instead of $classnames
?
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.
Thanks for noticing!
ffc9ebc
to
16b1b02
Compare
When creating an Archives Block while having no posts published, the Archives Block is empty and overlaps with the subsequent Blocks. This addresses that by setting the correct Block content when there are no Archives to show.
16b1b02
to
e9c7086
Compare
@caxco93: Thanks for the PR! It seems like this could be simplified further: rather than duplicating the $block_content = sprintf(
'<ul class="%1$s">%2$s</ul>',
esc_attr( $class ),
$archives ? $archives : __( 'No archives to show.', 'gutenberg' )
); |
Yeah it could be simplified with something along those lines, but with that example you gave we would have an This was actually based on a similar implementation for the empty Comments Block, but now that you point this out, I think that we should stick to a simple what do you think @pento ? |
a2542b8
to
e63ad07
Compare
Oh, I totally missed the This looks good to me, thanks @caxco93! |
Just a little note, we probably should have had a design check on this but we can retro do. In future as this is a state lets get insight here. |
Description
When creating an Archives Block while having no posts published, the
Archives Block is empty and overlaps with the subsequent Blocks.
This addresses that by setting the correct Block content when there
are no Archives to show.
How has this been tested?
Built in tests and manually
Screenshots
Before:
After:
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
Fixes #9418