Have you changed any keybindings before?
You might have changed one of them unintentionally. Verify your bindings, this might fix the issue.
If that doesn't work give this a shot:
1. Uninstall Holdfast
2. Delete this folder: C:\Users\Your Username\AppData\LocalLow\Anvil Game Studio
If the issue continues after this:
Make the glitch happen again, then press F2 and take a screenshot of the log - you may have an error in the log.
edit: also, you should know that if you fire without aiming in Holdfast you go into melee. This isn't what you're experiencing, right?