React-autosuggest: Preventing default up/down key behavior even when no suggestions are available.

Created on 28 Feb 2018  路  5Comments  路  Source: moroshko/react-autosuggest

Default behavior for pressing the up and down keys is being preventDefault'ed, even in cases where the autosuggest does not need to be using special handling for them. In input elements, this manifests as not being able to quickly jump to the beginning and end of an input using these keys, and in textarea and contenteditable elements it prevents jumping between lines.

Single-line Input Reproduction Steps: (Use the Basic example)

  1. Focus the input field.
  2. Type asdf.
  3. Make sure there are no suggestions available.
  4. Press up.

Observed Behavior: The cursor does not move.

Expected Behavior: The cursor moves to be in front of the first character in the input.

Multi-line Input Reproduction Steps: (Use this codepen)

  1. Focus the input field.
  2. Type asdf.
  3. Press enter to create a new line.
  4. Type asdf again.
  5. Make sure there are no suggestions available.
  6. Press up.

Observed Behavior: The cursor does not move.

Expected Behavior: The cursor moves to the line above.

Most helpful comment

@moroshko, do you know when you'd have time to merge @ShibumiGrant's changes? I also have the same issue and the proposed changes work.

All 5 comments

Sounds reasonable. Would you like to contribute a PR?

Gladly! Let me know if any changes should be made.
Any idea when the next release will be?

@moroshko, do you know when you'd have time to merge @ShibumiGrant's changes? I also have the same issue and the proposed changes work.

Is the any progress in Preventing default up/down key behavior?

This is now resolved by #768

Was this page helpful?
0 / 5 - 0 ratings