react-modal icon indicating copy to clipboard operation
react-modal copied to clipboard

Switch from KeyboardEvent.keyCode to KeyboardEvent.code

Open robinmetral opened this issue 3 years ago • 2 comments

Hi! First of all, apologies for removing the issue template—since this isn't a bug report, I've found it hard to fill the reproduction steps.

I'm wondering if there's anything stopping us from switching from the deprecated KeyboardEvent.keyCode to KeyboardEvent.code in the ModalPortal:

https://github.com/reactjs/react-modal/blob/0847049f19eaed81715e1263705564a569577774/src/components/ModalPortal.js#L276-L285

We should probably stop relying on the deprecated property, and since React 18 dropped support for IE (which didn't support KeyboardEvent.code), I can't think of any blockers.

Using the deprecated property can already cause issues in browsers (or testing environments) that have removed support for it. I've ran into this using @testing-library/user-event (ref).

Happy to submit a PR for this!

robinmetral avatar Jun 13 '22 11:06 robinmetral

Hi, if it has been deprecated, we need to update.

PRs are always welcome.

diasbruno avatar Jun 13 '22 11:06 diasbruno

Awesome, thanks for the reply—will submit some time this week 🙂

robinmetral avatar Jun 13 '22 11:06 robinmetral