Items held in the offhand don't disappear when dying while any interface is open except the inventory
The Bug:
When dying whilst in a GUI, the item in the offhand stays held in the offhand in the Death screen even though KeepInventory is off.
Also, holding a totem in the offhand when inside a GUI, the totem is used but the item remains in the offhand (ghost item) even though the item was used.
Steps to Reproduce:
- Build the setup as shown in the provided attachment. setup.png

- Ensure that the "keepInventory" gamerule is set to "false" by running the command provided below.
/gamerule keepInventory false - Input the following command into the command block.
/kill @p
- Hold any item in your offhand and open the trapped chest.
- Look at the item held in your offhand on the death screen.
- Take note of how items held in the offhand don't disappear when dying while any interface is open except the inventory.
Observed Behavior:
Items held in the offhand don't disappear.
Expected Behavior:
Items held in the offhand would disappear.