Fix mobile keyboard/viewport jank on editor page#122
Open
hendriebeats wants to merge 2 commits into
Open
Conversation
Replace 100vh (which doesn't shrink when the mobile keyboard opens) with a 100vh → 100dvh → var(--vh-real) cascade. A lightweight VisualViewport listener sets --vh-real as progressive enhancement for browsers where dvh alone isn't sufficient. Lock body/html scrolling on the study page and block touch-drag on the header/toolbar grid areas to prevent unwanted page bounce. The editor scroll container (#mainEditorHolder) re-enables pan-y with contained overscroll. Add ProseMirror scrollThreshold/scrollMargin so the cursor stays visible above the keyboard and below the 86px header+toolbar.
Move touch-action: none from #studyPage (which blocked all child touch interactions) to just #header. Add overflow-x: auto + touch-action: pan-x on the toolbar so it can be swiped horizontally on narrow screens. Fix sidebar scroll: remove eager preventDefault() from touchstart handler in SidebarSections so the browser's native scroll isn't blocked. Instead, preventDefault() is called in touchMove only once the gesture is confirmed as a drag-to-reorder or swipe-to-delete. Add distance check to tap detection so flick-scroll gestures don't accidentally trigger section navigation.
Contributor
Author
|
@boxyoman I think this is the beginning of a stable solution to make it nicely usable on mobile. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
100vhon the study page grid with a100vh → 100dvh → var(--vh-real)cascade so the editor container shrinks correctly when the mobile keyboard opensVisualViewportlistener that sets a--vh-realCSS variable as progressive enhancement for browsers wheredvhalone isn't sufficienttouch-actionper element:noneon header,pan-xon toolbar (enabling horizontal swipe),pan-yon editor scroll containerscrollThreshold/scrollMarginso the cursor stays visible above the keyboard and below the 86px header+toolbarpreventDefault()inSidebarSections.tsuntil the gesture is confirmed as drag-to-reorder or swipe-to-delete, so native scroll worksoverflow-x: autovisualViewporthack fromindex.tsx