"Uncaught TypeError: t._inputs[r.a.Keyboard] is undef" for preview.babylonjs.com

We are running daily/build specs on our code and we are using preview.babylonjs.com.
The specs just failed with

Uncaught TypeError: t._inputs[r.a.Keyboard] is undefined
    _keyboardUpEvent https://preview.babylonjs.com/babylon.js:16

Has something changed in preview.babylonjs.com compared to yesterday, that we should migrate to?


Thanks for reporting this! We are investigating and will update as soon as possible

Would you be able to show a bit more than a single line? a stacktrace maybe? Or a live example?

This is the only thing that is shown in the log.

Which I now see is different from the previous error. I don’t know why.

I sat down to do some development and here are the test cases

When I press delete I would like the element to be disabled.

Test case

      const scene = ...
      const canvas = scene.getEngine().getRenderingCanvas();
      canvas.tabIndex = -1;
      canvas.dispatchEvent(new KeyboardEvent("keydown", { "key": "Delete" }));


this._scene.onKeyboardObservable.add(arg => {
      const kbInfo = /** @type {BABYLON.KeyboardInfo} */ (arg);
      if (kbInfo.type == BABYLON.KeyboardEventTypes.KEYDOWN) {
        switch (kbInfo.event.key) {
          case "Delete":
               const tn = /** @type {BABYLON.TransformNode} */ (this.getNode());

Works with 4.2.0 and not with 5.0.0-alpha.6

The above code and test case works with Babylon.js v4.2.0 - WebGL2 - Parallel shader compilation but it does not work with Babylon.js v5.0.0-alpha.6 - WebGL2 - Parallel shader compilation

With 5.0.0-alpha6 we are not even entering the observer.

Playground example

Here is the console.log of the playground example which does not happen every time

Context and previous discussion

We have also previously discussed this in How could I send a programmatic button click to a scene? - #9 by kmitov which is again about button clicks.

1 Like

Interestingly you get this error in the console if you make changes in the playground editor.

Thanks, the problem was found and fixed already - Fix for undefined value on keyup event by PolygonalSun · Pull Request #9801 · BabylonJS/Babylon.js (github.com). There is a small issue with the .key value which will be fixed as soon as we can.

Thanks @RaananW. How do I know when has a PR reached the preview? If it is in master it is not enough I guess.

If there is a closed nightly after it is in preview. Next nightly will contain the fix. Will probably be in a few hours


Sharing with my team and generally on the Internet how running our specs against preview could help us all. Posting here for future references - The benefits of running specs against nightly releases of dependencies. |

1 Like