Skip to content

Make pointer caret scrolling gentler - #208

Merged
Renakoni merged 1 commit into
mainfrom
experiment/gentle-caret-follow
Aug 13, 2026
Merged

Make pointer caret scrolling gentler#208
Renakoni merged 1 commit into
mainfrom
experiment/gentle-caret-follow

Conversation

@Renakoni

Copy link
Copy Markdown
Owner

Summary

  • distinguish pointer-placed carets from programmatic selection changes in Muya
  • leave fully visible pointer-placed carets exactly where the user tapped
  • smoothly reveal only genuinely clipped pointer carets with a 16px inset
  • preserve the existing 100px caret-follow band for Enter, undo/redo, and structural edits
  • respect prefers-reduced-motion by using immediate minimal correction

Why

The existing caret-follow handler applied the desktop 100px comfort band to every collapsed selection change. On Android, ordinary taps therefore recentered text near the top or bottom edge, producing repeated jumps and visible flashing while the user moved the caret line by line.

Muya now carries an explicit user-pointer or programmatic source in its selection-change payload. This avoids timing heuristics and keeps the two interaction contracts separate.

Behavior

  • A line that is fully visible does not move, including the last fully visible line.
  • A partially clipped line is revealed with only the required movement plus a 16px inset.
  • Pointer corrections use a short native smooth scroll unless reduced motion is requested.
  • Programmatic edits retain the existing immediate comfort-band follow.
  • Expanded selections and native handle drags remain untouched.

Verification

  • Web unit tests: 83 files / 701 tests
  • Muya app gate: 221 files / 1549 tests
  • caret-follow mobile WebView E2E: 2/2
  • pnpm typecheck
  • pnpm build
  • focused ESLint
  • Android assembleDebug --rerun-tasks
  • manual APK evaluation of the final no-movement-while-visible policy

@Renakoni
Renakoni merged commit e6415a6 into main Aug 13, 2026
6 checks passed
@Renakoni
Renakoni deleted the experiment/gentle-caret-follow branch August 13, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant