First, look at this GIF. (Sorry for bad encoding quality)
I'll explain what's happening in the GIF.
After you opens/closes a door, if you are looking at the air block, it triggers Left-Click event.
My free-build plot got small issue with this bug.
EDIT: Actually, it triggers Left-click event when you move your hand while you are looking at air. So buttons have same issue too.
GIF for buttons:
EDIT 2: This problem can be solved by making a tick counter (with mob based 1 tick loop or something else), storing the tick of last right click and left click and comparing which tick you right clicked and left clicked. if these ticks are same, make left click event stop reading code.
NOTE: These GIFs are recorded in OptiFine modded client but I tested with unmodded vanilla client too, and the same glitch happened.