mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +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 = () => {
|
const dispatchSelect = () => {
|
||||||
dispatch("select", { selectedId, selectedItem });
|
dispatch("select", {
|
||||||
|
selectedId,
|
||||||
|
selectedItem: items.find((item) => item.id === selectedId),
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const pageClickHandler = ({ target }) => {
|
const pageClickHandler = ({ target }) => {
|
||||||
|
@ -164,7 +167,7 @@
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent.removeEventListener("click", pageClickHandler);
|
parent.removeEventListener("click", pageClickHandler);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue