Skip to content

Commit

Permalink
fix selecting elements after opening dropdown with arrow keys
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaBanaszkiewicz committed Oct 26, 2024
1 parent fbcee92 commit 752e1ca
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function useComboboxTargetProps({
if (!ctx.store.dropdownOpened) {
ctx.store.openDropdown('keyboard');
setSelectedOptionId(ctx.store.selectActiveOption());
ctx.store.updateSelectedOptionIndex('selected', { scrollIntoView: true });
} else {
setSelectedOptionId(ctx.store.selectNextOption());
}
Expand All @@ -51,6 +52,7 @@ export function useComboboxTargetProps({
if (!ctx.store.dropdownOpened) {
ctx.store.openDropdown('keyboard');
setSelectedOptionId(ctx.store.selectActiveOption());
ctx.store.updateSelectedOptionIndex('selected', { scrollIntoView: true });
} else {
setSelectedOptionId(ctx.store.selectPreviousOption());
}
Expand Down

0 comments on commit 752e1ca

Please sign in to comment.