Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[p5.js 2.0 RFC Proposal]: Replace deprecated keyCode functionality and docs with KeyboardEvent.code & KeyboardEvent.key web standard replacements #7436

Open
6 of 21 tasks
RandomGamingDev opened this issue Dec 20, 2024 · 1 comment

Comments

@RandomGamingDev
Copy link
Contributor

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 keyCodes 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.

Cons (updated based on community comments)

  • Work: It'll take some work to replace it when keyCodes shouldn't get removed from browsers for at least a couple years if not more than a decade.

Proposal status

Under review

@RandomGamingDev
Copy link
Contributor Author

Note: This issue is related to #6798

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant