transformPasted doesn't catch pasted

Hi everyone!

We’ve encountered a strange issue: transformPasted doesn’t catch text pasted from the clipboard or via the quick paste feature on Android. We’ve tested this with several keyboards, including Gboard, SwiftKey, and YandexBoard.

We use transformPasted to detect pasted links. While we could consider using beforeinput, it’s important for us to work with the Slice object that transformPasted provides.

If you need any additional details, please let me know.

It is likely that this text is injected directly by the virtual keyboard, through the IME system, and doesn’t get treated as a paste event by the browser. I’ll do some experiments.

1 Like

I confirmed that there is no paste event and, for the browser, this is treated exactly as other keyboard text input (such as selecting a suggested word) would be. So I think getting paste-related hooks to run in this situation isn’t going to be possible—there’s no way for the library to even identify it as a paste. On the bright side, users can only insert plain text this way, and may not really expect the action to be treated as a paste.

1 Like