fix: Text cursor flicker in trailing block#2839
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR prevents unwanted selection movement into the trailing block widget by adding keyboard navigation interception and visual selection prevention. A ChangesTrailing Widget Selection Prevention
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/mantine
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
commit: |
|
Summary
Currently, pressing the right or down arrow at the end of the last block in the document makes ProseMirror attempt to move the text cursor into the trailing block. Because the trailing block is just a decoration and can't actually contain the text cursor though, the cursor just flickers and returns to its previous position.
This PR adds explicit keyboard handling to prevent this from happening. Adding
user-select: noneor other CSS styles/HTML attributes to the trailing block isn't enough to fix the issue itself.Rationale
The flicker looks janky and unpolished, even it it doesn't functionally do anything.
Changes
handleKeyDowntoTrailingNodeExtension.Impact
N/A
Testing
I don't think this can even be tested. The selection doesn't actually update during the flicker AFAIK, so cannot test the editor state and visual regression testing is not really feasible either.
Screenshots/Video
N/A
Checklist
Additional Notes
N/A
Summary by CodeRabbit