I have finally realized why after years of playing this game why the right click menu seems inconsistent at times and overall feels janky and I'm curious if it's something that can be fixed if possible.
In short, if you right click anything in your inventory window and move your mouse a bit to the left after right clicking, the UI menu immediately closes. From my very non scientific testing, if you right click and move the cursor to the right, it works fine and doesn't close, but moving specifically to the left will always close the UI menu. I suspect this is due to the shape of the menu item stopping immediately to the left of the UI box that appears.
I've attached a video demonstrating the effect.
Sorry for this really dumb thing.