Description
Version
- Phaser Version: 3.54.0
- Operating system: Win 10 Pro 20H2
- Browser:
Description
After registering a key (a letter for example) with capturing enabled Phaser correctly captures the input events. This leads to not being able to type the letter in an input box outside of phaser. This is correct and expected.
However when removing this key, the capturing continues and therefore it still isn't possible to type the letter somewhere outside of Phaser.
I would expect that removing the last registration of a specific key also ends the capturing.
My current workaround is to trigger removeCapture()
manually.
Example Test Code
// Register key with capturing enabled by default
const key = scene.input.keyboard.addKey(keyCode);
// Removing the key
scene.input.keyboard.removeKey(key, true);
// Afterwards I still can't use it outside of Phaser
// Removing the capture manually fixes the issue
scene.input.keyboard.removeCapture(key.keyCode);
Additional Information
I would expect that removing the last registration of a specific key also ends the capturing.
I think triggering removeCapture()
manually is a workaround because in this case I have to keep track of all Key
objects listening to the specific key code.