I have tried changing several keys and the problem persists: when the character is aiming or running, the key to switch primary/secondary is ignored.

This bug does not appear when using "select primary" and "select secondary".