Open raineorshine opened 2 years ago
iOS Safari supports focus({ preventScroll: true })
as of v15.5:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#browser_compatibility
However this doesn't help when entering edit mode, which uses the default browser touch events. We cannot preventDefault when a user taps on a thought, since we need the browser to place the caret where the user taps.
Related: #1751
Not currently reproducible, but may recur after the current approach to cropping space around visible thoughts is changed.
Steps to Reproduce
null
and scroll so that all thoughts are within the viewport.h
and enter edit modeCurrent Behavior
The window scrolls down so that the focused thought is in the middle of the screen. The top thoughts are now obscured.
https://user-images.githubusercontent.com/750276/212205968-d020bc5d-fe3d-49a8-89e7-a64773f10df0.MOV
Expected Behavior
Autoscroll should scroll the minimum amount necessary to bring the cursor thought into view.
To Do
el.focus({ preventScroll })
onTouchEnd
body-scroll-lockonce scroll scrollTofocus focusInsetting contenteditable after touchoverride scrollIntoViewposition: fixedtransformadd readonly ontouchstart, and remove ontouchendkeyframesopacity: 0 gistoverflow: hiddenReferences