-
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
Inline commenting: UX Enhancements for Comments #67385
Inline commenting: UX Enhancements for Comments #67385
Conversation
Size Change: +151 B (+0.01%) Total Size: 1.83 MB
ℹ️ View Unchanged
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
…nt/inline-commenting-refactored-comments-component
Flaky tests detected in 9306f80. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12156256176
|
Hi @akasunil. Not sure if this is how it should work. When the thread is selected/focussed, the replies should be visible? I'm adding replies here, and they immediately disappear. Also, when a thread is focussed, I should see the reply form underneath. |
…nt/inline-commenting-refactored-comments-component
…nt/inline-commenting-refactored-comments-component
…nt/inline-commenting-refactored-comments-component
@akasunil I tested this again. One odd behaviour: when I click on another block, it shouldn't leave the comment focussed. Could we also rename this PR, I think the title is a bit misleading, it's not just a refactor? |
@@ -18,13 +18,17 @@ | |||
position: relative; | |||
padding: $grid-unit-20; | |||
border-radius: $radius-large; | |||
border: 1px solid $gray-300; | |||
border: 1.5px solid $gray-300; |
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.
Why add a half pixel here?
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.
not strong opinion here, We could change it to 1px or 2px, I updated it to make it same as active/focused state border to prevent layout shift on board active/focus state.
setActiveThread( blockCommentId ?? null ); | ||
setFocusThread( null ); | ||
setShowCommentBoard( false ); | ||
}, [ blockCommentId ] ); |
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.
Generally, setting state in an effect like this is not a good idea. Maybe just unmount the component with a key
so the local state within is automatically reset?
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 key
suggestion does not work?
I've verified on my end, and it functions as seen in the attached video below. Some video recording might help me understand this strange behavior you are experiencing with the comment board. Edit-Post-.Hello-World-.-.-gutenberg-.-WordPress.1.webm |
@akasunil It seems to happen when I manually focus a comment of a block that is not selected. When I then click on another block, it doesn't disappear. I think when I focus a comment, it should probably select the relevant block, but that's addressed in another 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.
Would just like to see us avoid setting state in an effect: #67385 (comment)
…nt/inline-commenting-refactored-comments-component
I have addressed that.
I think we will have to revisit this issue after (#66873) PR is merged. |
Now focus does not seem to clear when I select a different blocks. It's now possible to have two comments focussed at the same time. This should never be possible? |
onAddReply( inputComment, thread.id ); | ||
} } | ||
onCancel={ ( event ) => { | ||
event.stopPropagation(); // Prevent the parent onClick from being triggered |
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.
If we really need to do this, there must be really good reason for it. Why is there a click handler in a parent element. Is it focusable? Why not base comment focus on whether or not the wrapper or an inner focusable element is focussed?
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 removing the board's focus when the cancel button is clicked which conflicts with the parent element click event. I added a focus event to the wrapper element and the focus state in the parent component because we require one board focused at a time.
This is partially fixed, There is still issue when board is focused on board click. But i guess that would be resolved by (#66873). |
* Refactored comments components and show replies on button click * Update board and show more reply text styles * Set chronological order for reply comments * Improved functionality for thread focus and active state and other fixes * Remove board highlight on block selection change * Close popover on new comment option click * Fix styles for new comment board * Fix reply order issue * Remove unnecessary state * Set initial value for focusThread state and remove use of useEffect * Fix component remount issue Co-authored-by: akasunil <[email protected]> Co-authored-by: ellatrix <[email protected]>
Part of - #66377
What? & Why?
Refactored comments component for ease of use. and Implemented
show more replies
functionality on comment board. Reply comments will now be hidden by default and will be visible on board focus.Few more fixes/enhancements done in this PR are below:
Testing Instructions
Gutenberg
->Experiments
Screenshots or screencast
Edit-Post-.Hello-World-.-.-gutenberg-.-WordPress.webm