It seems to only happen when hovering over a single item, and then closing the inventory, stacks of 2 or more seem unaffected
This is only true for the local inventory, on external inventories (e.g. chests) it always takes items when hovering over them
Steps to Reproduce:
open inventory
close inventory while hovering over item
Observed Results:
the item moves to the first available slot, if no slots are available it drops
Expected Results:
the item stays where it is
Linked issues
is duplicated by 5
Attachments
Comments 15

Most likely related to MCPE-65815.
No, I don't think it is, these items are completely usable, and it happens in any inventory with any item
When I'm able to get on my computer, I will try to reproduce this. In the meantime though, please include steps to reproduce this issue as mentioned in the guidelines for posting a bug report.
This is related to the recent change that made Q and E work as right and left-click in JSON UI.
[media]Here is what happens:
Player presses E to close the inventory while hovering over an item
Minecraft sees this as a right-click in JSON UI
The hovered item is split using typical right-click behavior
Half the stack is now selected by the inventory cursor
The inventory closes
Minecraft knows the cursor is not a valid storage slot
The cursor items are moved to the first available inventory slot, which is in the hotbar
This explains why the behavior only occurs when E is used to close the inventory. This also makes the bug very easy to reproduce.
Can confirm, it behaves as expected when I disable full keyboard gameplay.
Is there a workaround? I'd like to keep using full keyboard gameplay.
This could be fixed if they made left and right click use the I and P keys instead. Those letters on the keyboard are also closest to the mouse for most players so it makes sense.