[p5.js 2.0 Bug Report]: Add documentation for the code
system variable in key handling.
#7881
Open
1 of 17 tasks
Most appropriate sub-area of p5.js?
p5.js version
2.x
Web browser and version
Firefox
Operating system
Linux
Steps to reproduce this
In p5.js, we currently support some ways to detect which key a user presses:
keyCode
,key
, andcode
are some of it. WhilekeyCode
andkey
are documented in the reference, thecode
variable has not yet been documented, which can lead to confusion for users.p5.js/src/events/keyboard.js
Lines 463 to 465 in c39ad5c
key
returns the character or value associated with the key press, regardless of the keyboard layout.code
returns the Constants on the keyboard (e.g., ENTER, ArrowUP), independent of what character is printed on that key.Because only
key
is documented, users do not know thatcode
exists or how it behaves.The text was updated successfully, but these errors were encountered: