p5.js-web-editor icon indicating copy to clipboard operation
p5.js-web-editor copied to clipboard

Move keydown handling out of IDEView

Open lindapaiste opened this issue 3 years ago • 0 comments

Progress on #1458 and #824

Should be merged after #2049 as I moved the Escape key handling into the new Modal component.

Changes:

  • Create new utility hook useKeyDownHandlers for adding one or more keydown handlers to the document, and component DocumentKeyDown which wraps the hook for use in class components.
  • Apply hook/component to Nav, Overlay, and Modal
  • Move the keydown handling from IDEView into new hook/component useIDEKeyHandlers/IDEKeyHandlers, which accesses redux props directly and allows a few props to be removed from IDEView.
  • Use the same keydown handling in MobileIDEView instead of repeating it.

I have verified that this pull request:

  • [x] has no linting errors (npm run lint)
  • [x] has no test errors (npm run test)
  • [x] is from a uniquely-named feature branch and is up to date with the develop branch.
  • [x] is descriptively named and links to an issue number, i.e. Fixes #123

lindapaiste avatar Aug 07 '22 19:08 lindapaiste