I have a reproducible issue here with undesirable scrolling after inserting text programmatically. I’m on latest iPadOS running on an iPad Pro 12.9, latest Drafts (20.1), and the device is in landscape orientation. To reproduce:
-
Create a long document. Doesn’t matter what the text is, as long as it’s more than will fit in the visible part of the editor all at once. Put the insertion point at the start of the document, so you’re scrolled to the top.
-
Create an action with a keyboard shortcut, and the following javascript:
editor.setTextInRange(10, 0, “NEW TEXT”);
editor.setSelectedRange(10,0); -
Trigger the keyboard shortcut for your action.
On my machine, 100% reproducibly, the action runs as desired (inserting the text at the proper place, and setting the insertion point position properly), BUT it also scrolls the viewport to the very bottom of the document. If I then start typing, the viewports jumps back to the top again, because that’s where the insertion point is.
Any thoughts on what’s going wrong?