docs/research/sources/editor-architecture/scroll-selection-visibility-runtime.md
Capture the editor-runtime evidence for keeping the caret visible without letting stale model selection, direct DOM measurement, or nested scroll parents fight each other.
The strongest editors do not treat scrolling as a free-floating helper.
They make scroll a post-selection, post-update request:
Slate v2 should steal that lifecycle, not the full ProseMirror, Lexical, or CodeMirror architecture.
Observed mechanism:
scrollIntoView() intent, and state keeps a
scrollToSelection counterscrollToSelection() uses the actual post-update selection head and
coordsAtPosscrollRectIntoView walks scroll parents from the selection DOM node to the
viewport, with threshold and margin controlsstoreScrollPos / resetScrollPos preserves scroll anchors when selection
update should not reveal the caretWhat Slate should steal:
What Slate should reject:
Observed mechanism:
What Slate should steal:
What Slate should reject:
$ helper API styleObserved mechanism:
EditorView.scrollIntoView is a transaction effectrequestMeasurescrollSnapshot records a restorable scroll anchorscrollMargins is a facet for fixed overlays and obscured viewport areasWhat Slate should steal:
What Slate should reject:
Observed mechanism:
scrollIntoView and focus options, but delegates
engine behavior to ProseMirror transactions and coordsAtPoscoordsAtPos for UI positioningEditor.scrollIntoView(range, center?) as a product API,
but its public docs do not expose the underlying algorithmWhat Slate should steal:
What Slate should reject:
Slate v2 should split the problem into three owned steps:
This makes the video-class failure hard to reintroduce: typing after a scroll-and-click cannot use an old model selection, and scroll cannot reveal the wrong caret.