Skip to content

Commit

Permalink
fix(dropdown): dispatch correct selectedItem in select event (#1646)
Browse files Browse the repository at this point in the history
Fixes #1645
  • Loading branch information
metonym authored Feb 5, 2023
1 parent 57b6ea6 commit d897484
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Dropdown/Dropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@
}
const dispatchSelect = () => {
dispatch("select", { selectedId, selectedItem });
dispatch("select", {
selectedId,
selectedItem: items.find((item) => item.id === selectedId),
});
};
const pageClickHandler = ({ target }) => {
Expand All @@ -164,7 +167,7 @@
if (parent) {
parent.removeEventListener("click", pageClickHandler);
}
}
};
});
</script>

Expand Down

0 comments on commit d897484

Please sign in to comment.