impress / impress.js

It's a presentation framework based on the power of CSS3 transforms and transitions in modern browsers and inspired by the idea behind prezi.com.
http://impress.js.org
MIT License
37.62k stars 6.67k forks source link

event.keyCode is deprecated, should upgrade to event.code #849

Closed mengwong closed 1 year ago

mengwong commented 1 year ago

https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode states

You should avoid using this if possible; it's been deprecated for some time. Instead, you should use KeyboardEvent.code, if it's implemented. Unfortunately, some browsers still don't have it, so you'll have to be careful to make sure you use one which is supported on all target browsers.

event.keyCode shows up in places like https://github.com/impress/impress.js/blob/9475720f42f8b8ffcf6efafe2f5bf80a9e59fcbd/src/plugins/navigation/navigation.js#L95-L107

Unless there are any objections I will fork and work toward a PR to fix this.

janishutz commented 1 year ago

That's good

janishutz commented 1 year ago

What I expected to be a problem with this solution: https://caniuse.com/?search=keyboardevent.code

This will break impress.js in older browsers like IE and mobile browsers (aka. Safari for iOS, Firefox for Android, etc.)

Compare it to: https://caniuse.com/?search=keyboardevent.keyCode, which is supported by almost every major browser out there.

We should consider implementing a way to notify the user about incompatible plugins & automatically disable the plugins relying on these features, if the browser does not support it to retain support for old browsers with the most recent versions of impress.js.

Although this is great to offer, I personally am in favour of dropping support for the old browsers barely anyone uses any more nowadays. People that need to use those browsers should use a different CDN-Link or V2.0.0 instead of a new (future) release or upstream.

mengwong commented 1 year ago

Let's move the discussion into the PR #851