If we sell an item immediately before buying an active item, the active item defaults to the ‘z’ hot key. In the past, we were able to have the selection screen where we could assign the new item to z, x, c, or v.
I am familiar with this bug but never looked into what causes it. Off the top of my head I wanna say I think it only happens when the game forces me to sell something first. I believe the sale window comes up and it ignores the key designation window.