# Document all known values for things like IKeyboardEvent.type:string

**URL:** <https://forum.babylonjs.com/t/document-all-known-values-for-things-like-ikeyboardevent-type-string/21924>\
**Category:** Feature requests\
**Tags:** documentation\
**Created:** [June 27, 2021, 8:40pm UTC](https://forum.babylonjs.com/t/document-all-known-values-for-things-like-ikeyboardevent-type-string/21924 "2021-06-27T20:40:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![raould](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raould/32/17066_2.png) [@raould](https://forum.babylonjs.com/u/raould)\
**Post date:** [June 27, 2021, 8:40pm UTC](https://forum.babylonjs.com/t/document-all-known-values-for-things-like-ikeyboardevent-type-string/21924/1 "2021-06-27T20:40:42Z")

</div>

> **[IKeyboardEvent | Babylon.js Documentation](https://doc.babylonjs.com/typedoc/interfaces/babylon.ikeyboardevent#type)**
>
> Native friendly interface for KeyboardEvent Object \[API\]

It is a string and it is hard to know what all the possible values are for it from just the API docs, but I wonder if it would be (crazy but) possible to eg programmatically find all the uses in the source code and update the docs with a list of them, or link to a list of them.

---

<div class="post-metadata">

**Author:** ![raould](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raould/32/17066_2.png) [@raould](https://forum.babylonjs.com/u/raould)\
**Post date:** [June 27, 2021, 8:43pm UTC](https://forum.babylonjs.com/t/document-all-known-values-for-things-like-ikeyboardevent-type-string/21924/2 "2021-06-27T20:43:22Z")

</div>

curiously there are things like [KeyboardEventTypes | Babylon.js Documentation](https://doc.babylonjs.com/typedoc/classes/babylon.keyboardeventtypes) which makes me wonder if the source code could/should be changed so that the static type of IKeyboardEvent.type is not just a bare string, but a properly constrained KeyboardEventType?

---

<div class="post-metadata">

**Author:** ![raould](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raould/32/17066_2.png) [@raould](https://forum.babylonjs.com/u/raould)\
**Post date:** [June 27, 2021, 8:46pm UTC](https://forum.babylonjs.com/t/document-all-known-values-for-things-like-ikeyboardevent-type-string/21924/3 "2021-06-27T20:46:59Z")

</div>

oh those aren’t at the same level of abstraction, one is at the Info level, the other at the Info.Event level… kinda confusing… oh well heh. Would still be super cool if the Info.Event.type:string api docs said what the possible strings were somehow.

---

<div class="post-metadata">

**Author:** ![raould](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raould/32/17066_2.png) [@raould](https://forum.babylonjs.com/u/raould)\
**Post date:** [June 27, 2021, 9:14pm UTC](https://forum.babylonjs.com/t/document-all-known-values-for-things-like-ikeyboardevent-type-string/21924/4 "2021-06-27T21:14:39Z")

</div>

[Interacting With Scenes | Babylon.js Documentation](https://doc.babylonjs.com/divingDeeper/scene/interactWithScenes#keyboard-interactions) says " By customizing the following code template you can control reactions within your scene to different keys. Both the `ascii` code for the key and the key itself are available to you." which is almost helpful… it would be super great if there were a link to documentation about the possible values for those!

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [June 27, 2021, 9:15pm UTC](https://forum.babylonjs.com/t/document-all-known-values-for-things-like-ikeyboardevent-type-string/21924/5 "2021-06-27T21:15:29Z")

</div>

Adding @RaananW to see if he can think of something else than manually documenting it

---

<div class="post-metadata">

**Author:** ![raould](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raould/32/17066_2.png) [@raould](https://forum.babylonjs.com/u/raould)\
**Post date:** [June 27, 2021, 10:09pm UTC](https://forum.babylonjs.com/t/document-all-known-values-for-things-like-ikeyboardevent-type-string/21924/6 "2021-06-27T22:09:00Z")

</div>

This helped me although the wording is still confusing… [https://stackoverflow.com/a/44213036](https://stackoverflow.com/a/44213036)

BabylonJS documentation could perhaps say  
“event.key → link to MDN for that”  
“event.keyCode → link to MDN for that” and warn do not use, prefer:  
“event.code → link to MDN for that”

HOWEVER what i worry about next is how does this work for e.g. “native” Babylon?! 🙂

fwiw.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 28, 2021, 8:26am UTC](https://forum.babylonjs.com/t/document-all-known-values-for-things-like-ikeyboardevent-type-string/21924/7 "2021-06-28T08:26:40Z")

</div>

I am a bit confused as to the actual issue here.

You are linking to event.type , which is the native event type ([Event.type - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/Event/type)), but later talk about key, keyCode and code.

I assume you are talking about this entire class and what the entire meaning of the event datatypes.  
This interface is meant to unify the event interface between browser(core) babylon implementation and native implementation, which doesn’t have the full concept of browser events. It’s a direct copy of [Event - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/Event) and copies from the source event as much as it can. Babylon native might not populate the entire event (the required fields will always be supported). @bghgary can help explaining how babylon native deals with that.

I do agree it could have been better documented though 🙂 This is an Event interface without using the DOM typescript lib. That’s about it, in general.

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [June 28, 2021, 6:15pm UTC](https://forum.babylonjs.com/t/document-all-known-values-for-things-like-ikeyboardevent-type-string/21924/8 "2021-06-28T18:15:38Z")

</div>

@PolygonalSun and @sebavan will be working on the input work soon but we haven’t really nailed this down yet for Babylon Native. +1 on more documentation.
