[resubmition of previous report which was closed due to me not attaching a video in time]
Holding down a key to switch an item to another inventory slot while hovering over it in the inventory sometimes causes the item to duplicate.
Reproducing the bug on a pure vanilla (non-Optifine) version of Minecraft: https://youtu.be/GClXqYVNqbg. I hold down 9 while mousing over the sword. The bug seems to be more consistent at higher render distances (i.e. lower frame rates). It took multiple minutes of holding the button down to trigger the bug at a render distance of 3, for example. The bug took considerably less time to trigger on vanilla than on Optifine, further suggesting that it is tied to framerate (Optifine being a performance-enhancing mod).
Also of note is that sometimes it isn't the item that gets duplicated but rather the blank hotbar slot one is swapping it with: https://youtu.be/ZGc7drZPRIE
Thank you for your report!
We're tracking this issue in MC-166905, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki