Skip to content

Commit

Permalink
prevent arrow up and down
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte committed Jul 19, 2024
1 parent a6db545 commit 4700cbc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/bits-ui/src/lib/bits/combobox/combobox.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ class ComboboxInputState {
#onkeydown = async (e: KeyboardEvent) => {
const open = this.root.open.value;
const inputValue = this.root.inputValue;

// prevent arrow up/down from moving the position of the cursor in the input
if (e.key === kbd.ARROW_UP || e.key === kbd.ARROW_DOWN) e.preventDefault();
if (!open) {
if (INTERACTION_KEYS.includes(e.key)) return;
if (e.key === kbd.TAB) return;
Expand Down

0 comments on commit 4700cbc

Please sign in to comment.