Repository navigation
Notes: Share thread focus recovery across actions - #85455
Conversation
Move the adjacent-thread pick out of handleDelete into focusThreadOrAdjacent, so any action that can drop a thread from the list reuses it. Delete handling moves into NoteThread next to resolve. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drops the action props Notes passed down only to forward them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🤖 PR meta 🤖🎉 PropsIf 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. Updated as activity occurs, without notifying anyone named here. Add the ⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome 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. Regression: updating a specific option will only change its value and will not corrupt others in
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Code looks good, I'm going to do some manual testing in Playground. |
|
This worked well in my manual testing. I also asked Claude to go thru and try various Note actions, tracking the focus and will post the results shortly. |
|
This tested well and pulling the focus logic into one place makes sense. I had Claude test this in Playground and it worked as expected. Claude reports:
|
|
Thanks, Adam! My Claude review reported similar cases. I ignored the extra description, which LLMs seem to like for some reason. The |
What?
Follow-up to #84060
Moves the adjacent-thread focus logic out of
handleDeleteinto a sharedfocusThreadOrAdjacenthelper inNotes, used by delete, resolve, collapse, and reply cancel.NoteThreadandAddNotenow calluseNoteActionsdirectly instead of receiving the actions as props.Why?
Any action can drop a thread from the list, and when the focused thread unmounts, focus falls to the document body. Only
handleDeletehandled this, with its own neighbor lookup, so every other action would need to repeat it.How?
focusThreadOrAdjacent( thread, nextThread )focuses the thread if it stays, otherwise the next or previous thread, and falls back to the block when none is left. Select the neighbor only if the leaving thread was selected. On trunk, a thread leaves only when deleted (nextThreadisnull); #84060 adds the filter check to this one condition.Testing Instructions
Testing Instructions for Keyboard
Same as above, using Tab to reach the note actions and Escape to collapse a note; focus stays on the collapsed note.
Use of AI Tools
Assisted by Claude.