Phaser API Documentation

preventDefault: boolean


A flag that controls if the non-modified keys, matching those stored in the captures array, have preventDefault called on them or not.

A non-modified key is one that doesn't have a modifier key held down with it. The modifier keys are shift, control, alt and the meta key (Command on a Mac, the Windows Key on Windows). Therefore, if the user presses shift + r, it won't prevent this combination, because of the modifier. However, if the user presses just the r key on its own, it will have its event prevented.

If you wish to stop capturing the keys, for example switching out to a DOM based element, then you can toggle this property at run-time.

Since: 3.16.0