fix: Scrolling to bottom of page on iOS - #3094
matthewlipski wants to merge 3 commits into
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: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe virtual keyboard hook now retains an unclipped keyboard height for Safari viewport calculations. It applies document scroll clamping only while the keyboard is open and clears the retained value after closure, orientation changes, or cleanup. ChangesVirtual Keyboard Scroll
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~15 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The scroll-clamping change has no confirmed merge-blocking risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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. A rabbit watched the keyboard rise Comment |
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/diagram-block
@blocknote/mantine
@blocknote/math-block
@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
@blocknote/xl-typst-exporter
commit: |
|
| const max = Math.max( | ||
| 0, | ||
| html.scrollHeight - unclippedKeyboardHeight / scale, | ||
| ); |
There was a problem hiding this comment.
Is there a way to simplify this logic, it's getting to be a bit of a mess, maybe it can be simpler to cache the maximum instead of of the unclippedKeyboarHeight instead. Presumably you want the absolute maximum and for it to go no further? Unsure, what we can do here
|
Closing as the jitter caused by these changes at the bottom of the page makes for a worse overall UX than just having the gap between the keyboard and formatting toolbar. |
Summary
This PR partially fixes this issue in #3031. You can now scroll to the bottom of the page again, but there is a lot of jitter once the bottom of the page is reached.
This is because the core fix to the iOS gap issue is the same. iOS has extra space below
bodyfor scrolling which the formatting toolbar cannot follow the virtual keyboard into when scrolling down. So whenever we scroll further than the bottom ofbody, we scroll back up to it. This "snap back" is what causes the jitter. The aforementioned issue was due to the scroll position at the bottom ofbodynot taking the height of the virtual keyboard into consideration, which is fixed in this PR.I tried an alternative approach which tried to prevent the "snap back" behaviour by preventing touch events from propagating into scroll events, so that we could prevent the scroll before it happens rather than snapping back to a previous position after it happens. However, this resulted in a ton of extra complexity as it had to account for things like dragging momentum, yet didn't meaningfully help with the jitter.
Rationale
See this issue
Changes
Updated
useVirtualKeyboardhook.Impact
I'm not convinced this results in better UX than just having the gap on iOS. The jitteriness imo is more annoying from a UX perspective.
Testing
Given we elected not to include iOS emulation in our automated tests, tests have not been added as they require an iOS environment to reproduce.
Screenshots/Video
ScreenRecording_09-17-2026.12-20-58_1.MP4
Checklist
Additional Notes
N/A
Summary by CodeRabbit