Sorry for the late response. Here is a youtube video of it happening https://youtu.be/odCVrZLrYIU
Sorry for the soundtrack 🙂 Kids had the tv on and I obvs don't make minecraft videos often.
In anycase, you can see that the typing does not go weird until after I switch away from minecraft to some other app then back again. (You can't see it but I used CMD-Tab to switch to another app)
After reading MC-3643 you're right, it does seem a lot like a duplicate.