Preventing default up/down key behavior even when no suggestions are available.
See original GitHub issueDefault behavior for pressing the <kbd>up</kbd> and <kbd>down</kbd> 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)
- Focus the input field.
- Type
asdf
. - Make sure there are no suggestions available.
- Press <kbd>up</kbd>.
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)
- Focus the input field.
- Type
asdf
. - Press enter to create a new line.
- Type
asdf
again. - Make sure there are no suggestions available.
- Press <kbd>up</kbd>.
Observed Behavior: The cursor does not move.
Expected Behavior: The cursor moves to the line above.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How do you prevent arrow up/down default behaviour in a ...
The input field is single line, so I am using the arrow up/down key to select a suggestion and Enter to insert it....
Read more >Why has the function of my up & down arrow keys changed ...
Normally, I scroll down a web page a bit at a time using the down arrow key on my laptop keyboard. Since yesterday,...
Read more >#7639 (Key up/key down in textarea's should optionally not ...
So whenever autocomplete suggestions are not displayed I want user to be able to use arrow keys to serve default behaviour of the...
Read more >keydown and keyup events do not have proper keyCode (it's ...
3. Press any key. It will always show a keyCode of 0. Expected result: The keydown event should produce a proper keyCode.
Read more >Windows Terminal Actions | Microsoft Learn
For instance "\u001b[A" will behave as if the up arrow button had been pressed. Command name: sendInput. Default binding: This command is not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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.
Sounds reasonable. Would you like to contribute a PR?