Choices icon indicating copy to clipboard operation
Choices copied to clipboard

KeyboardEvent

Open FrantzUml opened this issue 4 years ago • 1 comments

I discover this library that is great (thanks). But I noticed 2 points :

  1. in "constants" file for KEY_CODES object : BACK_KEY should be 8 (and not 46), and DELETE_KEY should be 46 (and not 8)
  2. The KeyboardEvent.keyCode is deprecated and should be replaced by KeyboardEvent.code

For example, export const BOARD_CODES = { BACK_KEY: "Delete", DELETE_KEY: "Backspace", ENTER_KEY: "Enter", A_KEY: "KeyA", ESC_KEY: "Escape", UP_KEY: "ArrowUp", DOWN_KEY: "ArrowDown", PAGE_UP_KEY: "PageUp", PAGE_DOWN_KEY: "PageDown" }; The type should be replaced too.

Thanks

FrantzUml avatar Jan 13 '22 11:01 FrantzUml

  1. in "constants" file for KEY_CODES object : BACK_KEY should be 8 (and not 46), and DELETE_KEY should be 46 (and not 8)

Nice catch, I'd be happy to merge a PR with this change (and a change to the interface as well).

  1. The KeyboardEvent.keyCode is deprecated and should be replaced by KeyboardEvent.code

While keyCode is deprecated, that has been the case for at least 8 years and it's still supported by all browsers. code on the other hand is not supported by IE11 or many mobile browsers. For now we'll stick with keyCode.

mtriff avatar Jan 14 '22 00:01 mtriff