It works fine in chrome but somehow not in Firefox.This happens even after a user clicks on the gamescreen or if space is assigned to a function ingame.
I'm not sure how well Construct 3 works in Firefox. The only thing I can think of is use Chrome or make your game fullscreen using the Browser object.
Develop games in your browser. Powerful, performant & highly capable.
Presumably you are displaying a C3 game in an iframe? Normally C3 games aren't scrollable so this type of problem isn't possible.
If the parent page is scrollable, you can use JavaScript to prevent the default action for a spacebar keypress.