mousetrap icon indicating copy to clipboard operation
mousetrap copied to clipboard

ev.which is readonly and hence should not be assigned during normalization.

Open fa93hws opened this issue 2 years ago • 0 comments

https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/which image

https://github.com/ccampbell/mousetrap/blob/2f9a476ba6158ba69763e4fcf914966cc72ef433/mousetrap.js#L721

            if (typeof e.which !== 'number') {
                e.which = e.keyCode;
            }

should becomes something like

const charCode = (typeof e.which == "number") ? e.which : e.keyCode;

and charCode should be passed to methods later instead of using e.which everywhere.

fa93hws avatar Sep 19 '21 12:09 fa93hws