Skip to content

Commit

Permalink
close dropdown when focusInputOnSelect = false
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Sep 21, 2023
1 parent 68cf526 commit 535a73f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lib/MultiSelect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,14 @@
selected = selected.sort(sortSelected)
}
}
if (selected.length === maxSelect) close_dropdown(event)
else if (
const focus_input =
focusInputOnSelect === true ||
(focusInputOnSelect === `desktop` && window_width > breakpoint)
) {
if (selected.length === maxSelect || !focus_input) {
close_dropdown(event)
} else if (focus_input) {
input?.focus()
}
dispatch(`add`, { option })
Expand Down

0 comments on commit 535a73f

Please sign in to comment.