React-autosuggest: Old broswers and keyboard problem

Created on 20 Jul 2017  路  3Comments  路  Source: moroshko/react-autosuggest

You have the following code in Autosuggest:

          switch (event.key) {
            case 'ArrowDown':
            case 'ArrowUp':

The problem is old browsers (小hrome 48 in the case) have no event.key:
image

Can you please rewrite the code like this:

          const keyCode = event.key || event.code;
          switch (keyCode) {
            case 'ArrowDown':
            case 'ArrowUp':

It will fix keyboard operation in Chrome 48 that is just 2 years old

Most helpful comment

v9.3.2 is on npm.

I ended up using event.keyCode instead of event.key || event.code.

Could you please verify that v9.3.2 solves your issue on Chrome 48?

All 3 comments

Could you submit a PR please?

Done. Please boost the npm version, my boss has Chrome 48 :(

v9.3.2 is on npm.

I ended up using event.keyCode instead of event.key || event.code.

Could you please verify that v9.3.2 solves your issue on Chrome 48?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luke-unifymonitor picture luke-unifymonitor  路  3Comments

eldyvoon picture eldyvoon  路  3Comments

gazpachu picture gazpachu  路  4Comments

icodejs picture icodejs  路  5Comments

devatlant picture devatlant  路  3Comments