{#each suggestionsItems as suggestion, index} {#if index === selected} setSelectedAndActive(index)} on:mouseup={() => { selectIndex(index); chooseSelected(); }} on:mouseenter={(event) => selectIfMousedown(event, index)} on:mouseleave={() => (active = false)} >{suggestion} {:else} setSelectedAndActive(index)} on:mouseup={() => { selectIndex(index); chooseSelected(); }} on:mouseenter={(event) => selectIfMousedown(event, index)} >{suggestion} {/if} {/each}