Spacebar behaves incorrectly in a virtual machine environment and does not take spaces but works fine locally. This may be a present issue in macOS Monterey and may be present in other releases of MAC OS.
The "Full Keyboard Access" accessibility feature was introduced in macOS Monterey. This feature alters the behavior of many keyboard keys to allow for controlling macOS without using a mouse, and sometimes it appears to be enabled by default.
If that is the case, disabling "Full Keyboard Access" will fix the spacebar functionality.
To disable the feature:
- Open macOS System Preferences
- Click Accessibility
- Click Keyboard
- Uncheck Enable Full Keyboard Access