TextInput positionBlinkerAndSelection

Hi Dan!
I noticed that after pasting content into a TextInput, the content seems to disappear.
Following the events I noticed that the content is placed in the visible part of the window directly after pasting, however, the onKeydown event handler calls the internal positionBlinkerAndSelection method and that messes up the position of the content, moving it to the invisible area of the window.
Do you know why that may be?
Thanks!

We will have a look.

If we do not do the on "blinker" code then the text stays where it was pasted.

@pettis do you want to see if you can solve this? If not, we can have a go.

Use a local version of https://zimjs.org/cdn/017/zim_doc.js with:

<script src="https://zimjs.org/cdn/1.4.1/createjs.js"></script>
<script src="zim_doc.js"></script>

Hmm I thought I tested pasting content but might not have. Could we just listen for pasting on the element and move the cursor to the last character?

input.addEventListener("paste", (event) => {});
1 Like

I will give it a try.

Also if we do that we would need to watch for RTL. Just a thought that came to me.

1 Like

Seems to sort of get us there. It does not show the cursor at the end but rather leaves the text centered. At least it shows. I tried setting the positionBlinkerAndSelection after setting selection but it does what it did before. So there is some sort of setting that is being missed on paste.

Better for now, but if you ever feel like solving a problem... let us know if you come up with a solution.