Gear and flaps deploying in air when pressing ESC while using HOTAS

I have only a dedicated keybind on the keyboard and on the throttle for those functions.
But everytime i have the HOTAS connected and i press the ESC key during battle they deploy and rip.
Mildly annoying while doing SIM air battles.

Any tips on what can be wrong?