Skip to content

Commit

Permalink
[@mantine/core] Combobox: Fix incorrect logic of selected options whe…
Browse files Browse the repository at this point in the history
…n the dropdown is closed without selecting value (#7039)
  • Loading branch information
MariaBanaszkiewicz authored Nov 7, 2024
1 parent 4c5a270 commit 96f789f
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 96f789f

Please sign in to comment.