RTC: Fix collaborator cursor rendering in table cells#77276
RTC: Fix collaborator cursor rendering in table cells#77276karthikeya-io wants to merge 3 commits into
Conversation
|
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. |
|
@karthikeya-io Hello, and thank you for this contribution! We've been catching up on PRs and I believe that #77673 addressed this issue as well and has already been merged. Here's a quick runthrough of a few nested RichText components on nested-text-cursor-test.movIt looks like your solution was similar to the one we merged, with a I'm sorry we didn't get to your PR first! If you have time to take a look at #77673, please let me know if that works the same for you or if we missed anything. Thank you! |
|
I'm going to close this PR and the associated issue #76812, as I believe #77673 has covered this work. Thank you for your work on this issue and I apologize for getting to the other fix first, since this seems roughly equivalent. Please feel free to open a new issue and tag me if you see something missing from the implementation in |
|
Happy this issue got fixed. I tested it on the playground, and it looks like it is working as expected for tables, quotes, pullquotes, and files. It seems we can close #77654 as well. |
|
@karthikeya-io Great, thank you for testing! I'll close out the other issue as well. |
What?
Closes #76812
This PR fixes an issue where collaborator cursors fail to render in Table block cells during a Real-Time Collaboration (RTC) session.
Why?
Y.Text -> attributes Y.Map -> block Y.Map. While this works for other blocks, Table text is buried much deeper (inside Rows and Cells). The original logic would stop too early, fail to find the block ID, and return null.How?
Updated the selection flow to handle deep nesting:
post-editor-awareness.tsreplaced the fixed 2-level check with a while loop. This loop walks up the data tree until it finds the block ID.data-wp-block-attribute-keyto the HTML so the cell can be identified.getYjsValueByPathto get the Y.Text object for that specific cell using the attributetKey likebody[0].cells[1].content.cursor-dom-utils.tsto use theattributeKey. Instead of searching the whole table, it now jumps directly to the specific cell element before counting characters.ResolvedSelectiontype and the selection resolver to include theattributeKey, ensuring the cell's address is passed correctly.Testing Instructions
Screenshots or screencast
Screen.Recording.2026-04-15.at.7.18.34.PM.mov
Screen.Recording.2026-04-15.at.7.08.32.PM.mov
Use of AI Tools
Drafted with Gemini assistance and reviewed it before submission