-
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: Add new Comment Reply Link block #35774
Conversation
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @DAreRodz! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
8c6acc9
to
dd4c4a8
Compare
Hey! I want to explain what I did so far. It would be great to receive some feedback here. 😊 To generate the reply link, I'm using the To hide the reply link when the comment has a certain depth, I've created a loop that iterates over all the comment's ancestors. Is this loop OK, or is there a better way to know the depth value of a comment? And also, related to that: should the reply link be hidden in the editor as well when reached a certain depth? In that case, I guess the same loop should be replicated in the cc: @gziolo @ntsekouras |
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" |
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've just copied the icon from the design, and seems that this fill
attribute is overwritten by
.block-editor-block-icon.has-colors svg {
fill: currentColor;
}
making the icon look like this:
@jameskoster, do you know if there is a quick way to fix this or does the svg need to be changed?
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.
That looks like the wrong svg code anyway, let me grab the correct one:
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M6.68822 10.625L6.24878 11.0649L5.5 11.8145L5.5 5.5L12.5 5.5V8L14 6.5V5C14 4.44772 13.5523 4 13 4H5C4.44772 4 4 4.44771 4 5V13.5247C4 13.8173 4.16123 14.086 4.41935 14.2237C4.72711 14.3878 5.10601 14.3313 5.35252 14.0845L7.31 12.125H8.375L9.875 10.625H7.31H6.68822ZM14.5605 10.4983L11.6701 13.75H16.9975C17.9963 13.75 18.7796 14.1104 19.3553 14.7048C19.9095 15.2771 20.2299 16.0224 20.4224 16.7443C20.7645 18.0276 20.7543 19.4618 20.7487 20.2544C20.7481 20.345 20.7475 20.4272 20.7475 20.4999L19.2475 20.5001C19.2475 20.4191 19.248 20.3319 19.2484 20.2394V20.2394C19.2526 19.4274 19.259 18.2035 18.973 17.1307C18.8156 16.5401 18.586 16.0666 18.2778 15.7483C17.9909 15.4521 17.5991 15.25 16.9975 15.25H11.8106L14.5303 17.9697L13.4696 19.0303L8.96956 14.5303L13.4394 9.50171L14.5605 10.4983Z" />
</svg>
I assume we'll add this to the icon library as a follow up?
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.
55594da
to
78afe55
Compare
Thanks for your review, @gziolo. I've fixed all the issues you found. (*) (*) EDIT: all except those related to global styles. |
- It uses `get_comment_reply_link` to generate the link. - That function already cover most of the cases, except comments depth.
Using `#comment-reply-pseudo-link` for consistency. That pattern is being used in other blocks, e.g. Post Comment Author or Post Comment Date
The cases are: - The comment ID passed is invalid - The comment doesn't have any parents - There is no link to render
764c0e2
to
676a954
Compare
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.
Nice work on this PR 👍🏻
It still needs a rebase after I landed the Comment Author Avatar block that changes whitespaces in the lib/blocks.php
file.
BTW, I was wondering if it is worth adding PHP tests for the SSR of this block ― something similar to /phpunit/class-block-library-navigation-link-test.php 🤔
The Navigation block is far more complex. We could add PHP tests for the Comments Query Loop block once it is fully functional that tests the render_callback
behavior. Although, I feel like e2e tests are simpler to write and give more confidence because they ensure that the user experience is also good. We can look at that after we have all the required blocks in place.
I tested again the issues raised earlier and it looks like the font family handling is no longer an issue:
This is how it looks like now: The issue with the color contrast is still present and I'm about to file a new issue for that to discuss possible solutions. |
Description
This PR implements a block which adds a link to reply to a specific comment. The implementation will follow the design explained in the linked issue.
Will close #30576.
How has this been tested?
Typography, align and Color settings
NOTE: there is an issue related to global styles, check #35774 (comment)
Threads depth limit
2
.Invalid or missing comment ID
Only registered and logged in users can comment
Log in to reply
message or similar.Types of changes
New feature
Checklist:
*.native.js
files for terms that need renaming or removal).