-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Notes: Fix the 'glitch' when selecting a note with a missing block #72516
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
Conversation
juanfra
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.
Thanks for the PR! It's working well for me, code looks good.
note-glitch.mp4
|
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. |
|
I realized there are a couple more minor issues with Notes in this (missing block) state. I'll consolidate fixes here to make backporting easier. |
6b15cca to
3338a90
Compare
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.
Pushed the following changes:
- Updated orphaned thread checks to use
thread.blockClientIdwhen possible. - Added a condition to hide the "Back to block" button.
| // pass `null` as the second parameter to prevent focusing the block. | ||
| selectBlock( thread.blockClientId, null ); | ||
| toggleBlockSpotlight( thread.blockClientId, true ); | ||
| if ( !! thread.blockClientId ) { |
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 blockClientId will be undefined for orphaned threads.
| { !! thread.blockClientId && ( | ||
| <Button | ||
| className="editor-collab-sidebar-panel__skip-to-block" | ||
| variant="secondary" | ||
| size="compact" | ||
| onClick={ ( event ) => { | ||
| event.stopPropagation(); | ||
| relatedBlockElement?.focus(); | ||
| } } | ||
| > | ||
| { __( 'Back to block' ) } | ||
| </Button> | ||
| ) } |
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.
There's no block to return two, so we can hide this option.
|
Size Change: +14 B (0%) Total Size: 2.17 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 3338a90. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18690634914
|
…72516) Co-authored-by: Mamaduka <[email protected]> Co-authored-by: juanfra <[email protected]>
|
I've cherry-picked this manually onto the |
…72516) Co-authored-by: Mamaduka <[email protected]> Co-authored-by: juanfra <[email protected]>
What?
Part of #66377.
PR fixes a minor "glitch" when selecting a note with a missing block. This also prevented note selection and prevented users from performing associated actions.
Why?
Selecting a note also selects the associated block, which no longer exists, and the selection is clear. The selection change then resets the selected thread state.
Testing Instructions
Testing Instructions for Keyboard
Same.
Screenshots or screencast
CleanShot.2025-10-21.at.13.37.04.mp4