Open
Description
Increasing access
Due to the deprecation of the keyCode
in web standards as shown here and p5.js's reliance on it for keyboard input and all the doc's examples (at least those I've come in contact with) using them it's time to replace them with their KeyboardEvent.code
& KeyboardEvent.key
web standard replacements in order to guarantee the continued functioning of p5.js without having to.
Which types of changes would be made?
- Breaking change (Add-on libraries or sketches will work differently even if their code stays the same.)
- Systemic change (Many features or contributor workflows will be affected.)
- Overdue change (Modifications will be made that have been desirable for a long time.)
- Unsure (The community can help to determine the type of change.)
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- Build process
- Unit testing
- Internationalization
- Friendly errors
- Other (specify if possible)
What's the problem?
keyCode
is still the primary method of detecting key presses despite it being deprecated for a while now.
What's the solution?
Replace it with the KeyboardEvent.code
& KeyboardEvent.key
web standard replacements in order to guarantee the continued functioning of p5.js without having to.
Pros (updated based on community comments)
- Continued Support: Continued support by browsers who might remove support in the future
- Teaching Usage of Web Standards: Since a large part of p5.js is aimed at beginners we want to avoid teaching outdated and deprecated concepts like the
keyCode
. -
- Integration: Although we can keep
keyCode
s to maintain support with older libraries, not moving forward by adding official support and docs everywhere for the modern alternatives might mean losing the ability to intuitively integrate with libraries.
- Integration: Although we can keep
Cons (updated based on community comments)
- Work: It'll take some work to replace it when
keyCode
s shouldn't get removed from browsers for at least a couple years if not more than a decade.
Proposal status
Under review