Cursor positioning inconsistency when inserting images

AI-generated summary

Users discuss a cursor positioning bug when inserting images in a new topic. meglio describes how, after pasting an image via Ctrl+V and while the upload is in progress, typing in the topic title field causes the cursor to unexpectedly jump back to the inserted <img> tag once upload completes — potentially corrupting the topic name if typing quickly. They note this is an unintended side effect and suggest the cursor should not move unless explicitly triggered. sam agrees it’s annoying and acknowledges it can’t be 100% fixed, but can be improved. They illustrate a scenario: typing “hello world”, starting an image upload, then deleting “world” and typing “america” before upload finishes — the cursor may end up incorrectly positioned after the image tag, especially if there’s an empty space at the start. Both users imply the system should better preserve cursor context during asynchronous uploads, though full prevention may not be feasible due to timing constraints.

Here is how to reproduce the issue:

  1. Start typing a new topic.
  2. At some point press Ctrl+V to insert a large image from clipboard.
  3. While the progress bar showing per cent uploaded is counting, move to the topic name and start typing a topic name
  4. While you’re typing the topic name, the image finished uploading and the cursor unexpectedly gets moved next to the inserted <img> tag. If typing fast, you’ll almost always end with a few symbols from the topic name typed after the <img> tag before you notice it and stop typing.
  5. And anyway, it’s distracting - why should the cursor move at all without my intention to do so.

A variation of this issue would be to place the cursor somewhere in the text and start typing (right after pressing Ctrl+V). When the image download is finished, the <img> tag will be inserted right in place where your cursor is currently located, not where it was when Ctrl+V was pressed.

إعجاب واحد (1)

Yeah its a bit annoying can not be 100% fixed but can be way improved …

Can not be fixed:

  1. Type: “hello world”
  2. Upload image
  3. Delete “world”, type "america, before upload is done
  4. No sane spot to put image.

I guess best we can do is track cursor position when people start uploading image, then paste it there (in the first empty space after that original position.)

إعجابَين (2)