Skip to content

Fix mobile keyboard/viewport jank on editor page#122

Open
hendriebeats wants to merge 2 commits into
masterfrom
fix-mobile-keyboard-viewport
Open

Fix mobile keyboard/viewport jank on editor page#122
hendriebeats wants to merge 2 commits into
masterfrom
fix-mobile-keyboard-viewport

Conversation

@hendriebeats

@hendriebeats hendriebeats commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace 100vh on the study page grid with a 100vh → 100dvh → var(--vh-real) cascade so the editor container shrinks correctly when the mobile keyboard opens
  • Add a lightweight VisualViewport listener that sets a --vh-real CSS variable as progressive enhancement for browsers where dvh alone isn't sufficient
  • Lock body/html scrolling on the study page and scope touch-action per element: none on header, pan-x on toolbar (enabling horizontal swipe), pan-y on editor scroll container
  • Add ProseMirror scrollThreshold/scrollMargin so the cursor stays visible above the keyboard and below the 86px header+toolbar
  • Fix sidebar touch scrolling: defer preventDefault() in SidebarSections.ts until the gesture is confirmed as drag-to-reorder or swipe-to-delete, so native scroll works
  • Add distance check to sidebar tap detection so flick-scroll gestures don't trigger section navigation
  • Make toolbar horizontally scrollable on narrow screens via overflow-x: auto
  • Remove old commented-out visualViewport hack from index.tsx

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.
@hendriebeats

hendriebeats commented Feb 20, 2026

Copy link
Copy Markdown
Contributor Author

@boxyoman I think this is the beginning of a stable solution to make it nicely usable on mobile.

@hendriebeats hendriebeats added the Size: Small 21–100 lines: Single-purpose change, easy to review quickly. label Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size: Small 21–100 lines: Single-purpose change, easy to review quickly.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant