diff --git a/packages/bbui/src/OptionSelectDnD/OptionSelectDnD.svelte b/packages/bbui/src/OptionSelectDnD/OptionSelectDnD.svelte index 22d0fd03a0..09405325a6 100644 --- a/packages/bbui/src/OptionSelectDnD/OptionSelectDnD.svelte +++ b/packages/bbui/src/OptionSelectDnD/OptionSelectDnD.svelte @@ -9,8 +9,8 @@ export let constraints export let optionColors = {} - let options = [] + let options = [] let colorPopovers = [] let anchors = [] @@ -64,9 +64,14 @@ delete optionColors[optionName] } - const openColorPickerPopover = (optionIdx, target) => { - colorPopovers[optionIdx].show() - anchors[optionIdx] = target + const openColorPickerPopover = optionIdx => { + for (let i = 0; i < colorPopovers.length; i++) { + if (i === optionIdx) { + colorPopovers[i].show() + } else { + colorPopovers[i]?.hide() + } + } } onMount(() => { @@ -94,7 +99,7 @@ on:consider={handleDndConsider} on:finalize={handleDndFinalize} > - {#each options as option, idx (option.id)} + {#each options as option, idx (`${option.id}-${idx}`)}