-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Notes: Collapse note on blur #73158
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
Notes: Collapse note on blur #73158
Conversation
|
Size Change: +98 B (0%) Total Size: 2.42 MB
ℹ️ View Unchanged
|
|
I think the code quality could still be improved, but for now, it seems to be working as expected. Unfortunately, the package sync for RC1 has already begun, but let's consider whether it's worthwhile to ship this PR in RC2. I will work on refining this PR tomorrow. |
Mamaduka
left a comment
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.
This looks good, @t-hamano! I left some feedback, and I'll try to test this better tomorrow.
I think the code quality could still be improved, but for now, it seems to be working as expected.
I would like to do some refactoring after stable release is out. I think there is room for improvement.
|
For the merge commit here, let's please make sure we also utilize the list of co-authors from the related, now closed, PR: #73141 |
7d94682 to
13ed27c
Compare
|
Flaky tests detected in f06d5a0. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/19324994915
|
|
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. |
Mamaduka
left a comment
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.
Thank you, @t-hamano!
This works mostly great, but I've noticed that sometimes clicking on the note doesn't expand it. The behavior isn't consisten but happens often.
Screencast
CleanShot.2025-11-12.at.15.43.06.mp4
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'm having an issue with my local environment and can't currently build the Gutenberg plugin within my wordpress-develop checkout so I can't test myself. But the video appears to be a great improvement. I will try to test again in the morning.
Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com>
OK, I figured out what is happening.
I'll look into a solution. Maybe we should use 4159287a028866e632ce501dea95a6af.mp4 |
|
It may be a bit aggressive, but I think it meets the requirements. 1fadaf1ea54d0321a623829f8cf3eb04.mp4 |
Mamaduka
left a comment
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, @t-hamano!
It's a pity that we have to use so many safeguard in onBlur callback, but I don't have any better ideas.
It would be nice to get more testing and eyes on this.
I've noticed a small issue when selection moves to "orphaned" note. The spotlight remains.
Something like following should fix that. I've intentionally have condition for block selecction.
diff --git a/packages/editor/src/components/collab-sidebar/comments.js b/packages/editor/src/components/collab-sidebar/comments.js
index c35d3a7b68..64cbb21353 100644
--- a/packages/editor/src/components/collab-sidebar/comments.js
+++ b/packages/editor/src/components/collab-sidebar/comments.js
@@ -518,10 +518,10 @@ function Thread( {
const handleCommentSelect = () => {
setNewNoteFormState( 'closed' );
setSelectedThread( thread.id );
+ toggleBlockSpotlight( thread.blockClientId, true );
if ( !! thread.blockClientId ) {
// Pass `null` as the second parameter to prevent focusing the block.
selectBlock( thread.blockClientId, null );
- toggleBlockSpotlight( thread.blockClientId, true );
}
};Screencast
Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com>
Mamaduka
left a comment
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.
Can't spot any other issues and I like the fixed behavior. Since we're backporting this into RC, it would be nice to get more testing.
|
The Gutenberg package sync is planned at UTC9 tomorrow. Unless there is other feedback, I'd like to merge this PR in time for the package sync tomorrow. |
|
I ended up testing this just in Playground because my local environment still won't run Everything seems to be working great and I think it's a good improvement. There is one nuance that I noticed, though. When you clock off of a note, the click off does not sync to the opposite view for notes. So when the all notes panel is open, clicking off a selected note leaves the note expanded for the floating drawer of notes. blur-testing.mov |
|
I can confirm @desrosj results here, testing on my local. The expand/collapse state in this case doesn't sync between the Notes panel and the floating Notes sidebar. To replicate:
Additionally, expanding the Notes panel after step 5 will copy over the Note state to the expanded panel, meaning the Note that was previously collapsed before closing the panel will now be expanded. |
|
Thanks for the testing!
I believe this is a known issue that can be seen already in the trunk branch, or in 6.9 RC1. As far as I know, in the current implementation, the state of the floating sidebar and archive sidebar is not synchronized. Perhaps that issue can be addressed in a follow-up release if necessary. |
That works for me. I wanted to mention it, but even with that nuance, the functionality is better with this PR than not. |
|
Thanks for the feedback! Now let's backport this PR to 6.9. |
|
This is the merged prop based on this comment and the comment: |
* Notes: Collapse note on blur * Update comment * WIP * Don't debounce onBlur and onFocus * Avoid prop drilling * Simplify conditional statement * Update packages/editor/src/components/collab-sidebar/comments.js Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> * Correctly handle onBlur event * Add comment * Fix comment * Fix double space Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> * Always toggle block spotlight on note selection --------- Co-authored-by: karthick-murugan <karthickmurugan@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: desrosj <desrosj@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: roseg43 <gabertronic@git.wordpress.org>
|
I just cherry-picked this PR to the wp/6.9 branch to get it included in the next release: 48171a0 |
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/. - [Block Bindings: Add unit test coverage for `core/post-data` source](WordPress/gutenberg#73055) - [Block Bindings: Error handling for external sources.](WordPress/gutenberg#72585) - [Notes: Collapse note on blur](WordPress/gutenberg#73158) - [Border-radius values triggers unintended px conversion](WordPress/gutenberg#73324) - [Fix navigation tag entity binding](WordPress/gutenberg#73255) - [DataViews: ensure primary actions are not wrapped in the list layout](WordPress/gutenberg#73345) - [Fix: Fit Text may overflow into the padding area.](WordPress/gutenberg#73327) - [Merge "Icon Size" and "Icon size" translation strings](WordPress/gutenberg#73325) - [Notes: Improve delete confirm message for replies](WordPress/gutenberg#73173) - [Fix: Custom font size taking over fit text.](WordPress/gutenberg#73241) - [Fix a11y of descriptions and alerts for "Invalid" Nav Items](WordPress/gutenberg#73177) - [Stretchy text: Hide variations in Block Inspector (hack)](WordPress/gutenberg#73238) - [Update button label from "Add new note" to "Add new reply"](WordPress/gutenberg#73189) - [Notes: Fix first note creation with pinned sidebar](WordPress/gutenberg#73164) Developed in #10528. See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches. Fixes #64267. Props priethor. git-svn-id: https://develop.svn.wordpress.org/trunk@61262 602fd350-edb4-49c9-b593-d223f7449a82
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/. - [Block Bindings: Add unit test coverage for `core/post-data` source](WordPress/gutenberg#73055) - [Block Bindings: Error handling for external sources.](WordPress/gutenberg#72585) - [Notes: Collapse note on blur](WordPress/gutenberg#73158) - [Border-radius values triggers unintended px conversion](WordPress/gutenberg#73324) - [Fix navigation tag entity binding](WordPress/gutenberg#73255) - [DataViews: ensure primary actions are not wrapped in the list layout](WordPress/gutenberg#73345) - [Fix: Fit Text may overflow into the padding area.](WordPress/gutenberg#73327) - [Merge "Icon Size" and "Icon size" translation strings](WordPress/gutenberg#73325) - [Notes: Improve delete confirm message for replies](WordPress/gutenberg#73173) - [Fix: Custom font size taking over fit text.](WordPress/gutenberg#73241) - [Fix a11y of descriptions and alerts for "Invalid" Nav Items](WordPress/gutenberg#73177) - [Stretchy text: Hide variations in Block Inspector (hack)](WordPress/gutenberg#73238) - [Update button label from "Add new note" to "Add new reply"](WordPress/gutenberg#73189) - [Notes: Fix first note creation with pinned sidebar](WordPress/gutenberg#73164) Developed in WordPress/wordpress-develop#10528. See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches. Fixes #64267. Props priethor. Built from https://develop.svn.wordpress.org/trunk@61262 git-svn-id: http://core.svn.wordpress.org/trunk@60574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/. - [Block Bindings: Add unit test coverage for `core/post-data` source](WordPress/gutenberg#73055) - [Block Bindings: Error handling for external sources.](WordPress/gutenberg#72585) - [Notes: Collapse note on blur](WordPress/gutenberg#73158) - [Border-radius values triggers unintended px conversion](WordPress/gutenberg#73324) - [Fix navigation tag entity binding](WordPress/gutenberg#73255) - [DataViews: ensure primary actions are not wrapped in the list layout](WordPress/gutenberg#73345) - [Fix: Fit Text may overflow into the padding area.](WordPress/gutenberg#73327) - [Merge "Icon Size" and "Icon size" translation strings](WordPress/gutenberg#73325) - [Notes: Improve delete confirm message for replies](WordPress/gutenberg#73173) - [Fix: Custom font size taking over fit text.](WordPress/gutenberg#73241) - [Fix a11y of descriptions and alerts for "Invalid" Nav Items](WordPress/gutenberg#73177) - [Stretchy text: Hide variations in Block Inspector (hack)](WordPress/gutenberg#73238) - [Update button label from "Add new note" to "Add new reply"](WordPress/gutenberg#73189) - [Notes: Fix first note creation with pinned sidebar](WordPress/gutenberg#73164) Developed in WordPress/wordpress-develop#10528. See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches. Fixes #64267. Props priethor. Built from https://develop.svn.wordpress.org/trunk@61262 git-svn-id: https://core.svn.wordpress.org/trunk@60574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/. [Block Bindings: Add unit test coverage for core/post-data source](WordPress/gutenberg#73055) [Block Bindings: Error handling for external sources.](WordPress/gutenberg#72585) [Notes: Collapse note on blur](WordPress/gutenberg#73158) [Border-radius values triggers unintended px conversion](WordPress/gutenberg#73324) [Fix navigation tag entity binding](WordPress/gutenberg#73255) [DataViews: ensure primary actions are not wrapped in the list layout](WordPress/gutenberg#73345) [Fix: Fit Text may overflow into the padding area.](WordPress/gutenberg#73327) [Merge "Icon Size" and "Icon size" translation strings](WordPress/gutenberg#73325) [Notes: Improve delete confirm message for replies](WordPress/gutenberg#73173) [Fix: Custom font size taking over fit text.](WordPress/gutenberg#73241) [Fix a11y of descriptions and alerts for "Invalid" Nav Items](WordPress/gutenberg#73177) [Stretchy text: Hide variations in Block Inspector (hack)](WordPress/gutenberg#73238) [Update button label from "Add new note" to "Add new reply"](WordPress/gutenberg#73189) [Notes: Fix first note creation with pinned sidebar](WordPress/gutenberg#73164) Developed in #10528. See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches. Reviewed by davidbaumwald. Merges [61262] to the 6.9 branch. Props priethor, ellatrix. See #64267. git-svn-id: https://develop.svn.wordpress.org/branches/6.9@61263 602fd350-edb4-49c9-b593-d223f7449a82
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/. [Block Bindings: Add unit test coverage for core/post-data source](WordPress/gutenberg#73055) [Block Bindings: Error handling for external sources.](WordPress/gutenberg#72585) [Notes: Collapse note on blur](WordPress/gutenberg#73158) [Border-radius values triggers unintended px conversion](WordPress/gutenberg#73324) [Fix navigation tag entity binding](WordPress/gutenberg#73255) [DataViews: ensure primary actions are not wrapped in the list layout](WordPress/gutenberg#73345) [Fix: Fit Text may overflow into the padding area.](WordPress/gutenberg#73327) [Merge "Icon Size" and "Icon size" translation strings](WordPress/gutenberg#73325) [Notes: Improve delete confirm message for replies](WordPress/gutenberg#73173) [Fix: Custom font size taking over fit text.](WordPress/gutenberg#73241) [Fix a11y of descriptions and alerts for "Invalid" Nav Items](WordPress/gutenberg#73177) [Stretchy text: Hide variations in Block Inspector (hack)](WordPress/gutenberg#73238) [Update button label from "Add new note" to "Add new reply"](WordPress/gutenberg#73189) [Notes: Fix first note creation with pinned sidebar](WordPress/gutenberg#73164) Developed in WordPress/wordpress-develop#10528. See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches. Reviewed by davidbaumwald. Merges [61262] to the 6.9 branch. Props priethor, ellatrix. See #64267. Built from https://develop.svn.wordpress.org/branches/6.9@61263 git-svn-id: http://core.svn.wordpress.org/branches/6.9@60575 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
FYI I created #73412 as a follow-up to continue chasing down the issue that @desrosj flagged in #73158 (comment) |
Closes #72858
What?
This PR collapses the note when the focus is removed from that note.
Why?
The current behavior is intentional, but it differs slightly from what the user expects.
How?
The note will be collapsed when the focus is moved away from the outside of the note. Note that the note will not be collapsed when performing actions within the note, such as opening action popovers or pressing the Approve button.
Testing Instructions
Verify that the autom-collapsing of notes works correctly with both mouse clicks and keyboard navigation.
Screenshots or screencast
f2f523b9ce0672cb6a4060f15e914d28.1.mp4