mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
fix(dropdown): dispatch correct selectedItem
in select
event (#1646)
Fixes #1645
This commit is contained in:
parent
57b6ea68b5
commit
d897484abf
1 changed files with 5 additions and 2 deletions
|
@ -146,7 +146,10 @@
|
|||
}
|
||||
|
||||
const dispatchSelect = () => {
|
||||
dispatch("select", { selectedId, selectedItem });
|
||||
dispatch("select", {
|
||||
selectedId,
|
||||
selectedItem: items.find((item) => item.id === selectedId),
|
||||
});
|
||||
};
|
||||
|
||||
const pageClickHandler = ({ target }) => {
|
||||
|
@ -164,7 +167,7 @@
|
|||
if (parent) {
|
||||
parent.removeEventListener("click", pageClickHandler);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue