Skip to content

Commit

Permalink
Inline commenting: UX Enhancements for Comments (#67385)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Dec 10, 2024
1 parent 8e048a8 commit 8d9ce17
Show file tree
Hide file tree
Showing 6 changed files with 297 additions and 255 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function AddComment( {
return (
<VStack
spacing="3"
className="editor-collab-sidebar-panel__thread editor-collab-sidebar-panel__active-thread"
className="editor-collab-sidebar-panel__thread editor-collab-sidebar-panel__active-thread editor-collab-sidebar-panel__focus-thread"
>
<HStack alignment="left" spacing="3">
<CommentAuthorInfo />
Expand Down
19 changes: 12 additions & 7 deletions packages/editor/src/components/collab-sidebar/comment-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ const { CommentIconSlotFill } = unlock( blockEditorPrivateApis );
const AddCommentButton = ( { onClick } ) => {
return (
<CommentIconSlotFill.Fill>
<MenuItem
icon={ commentIcon }
onClick={ onClick }
aria-haspopup="dialog"
>
{ _x( 'Comment', 'Add comment button' ) }
</MenuItem>
{ ( { onClose } ) => (
<MenuItem
icon={ commentIcon }
onClick={ () => {
onClick();
onClose();
} }
aria-haspopup="dialog"
>
{ _x( 'Comment', 'Add comment button' ) }
</MenuItem>
) }
</CommentIconSlotFill.Fill>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ function CommentForm( { onSubmit, onCancel, thread, submitButtonText } ) {
__next40pxDefaultSize
accessibleWhenDisabled
variant="primary"
onClick={ () => onSubmit( inputComment ) }
onClick={ () => {
onSubmit( inputComment );
setInputComment( '' );
} }
disabled={
0 === sanitizeCommentString( inputComment ).length
}
Expand Down
Loading

1 comment on commit 8d9ce17

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 8d9ce17.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12251458022
📝 Reported issues:

Please sign in to comment.