When working on some JavaScript code that handles keyboard shortcuts, I noticed that KeyboardEvent.keyCode is deprecated and we should be using KeyboardEvent.key instead.
I rewrote my code. It's much clearer now. However I got some reports from users on Mac OS that it was no longer working. I don't have a Mac, but after doing some debugging on Browserstack, I found that when you press alt+p in Chrome on Mac OS, event.key is "π" rather than "p" as it is on other OSes.
I could hardcode that in, but it's ugly and also would be highly annoying because alt+p is not my only keyboard shortcut.
So I'm wondering, how am I supposed to handle this situation? How do I detect alt+p, or alt + some other key, and have it work reliably across platforms? Well, I know KeyboardEvent.keyCode can do it, but it's deprecated...