`await tick` instead of `setTimeout`
await tick() is what I tried originally (see https://github.com/janosh/svelte-multiselect/commit/c8f87660908f9f3335ed17b16d7c2c42c2a3eb79#diff-7d86c55b55f23806b2be4051d790e7c775fd5fa4e1ad3fc2da59eb51ce25c0e9L221) but it didn't work. Not sure why. If you have any clues, definitely interested to hear them.
Not entirely sure to be honest. In the much simpler component that I was playing around with, tick managed to do the job. Although my component is pretty basic compared to yours, and has far less event listeners. One way to debug this might be to remove the unrelated event listeners in hopes of isolating the issue.
Thanks, good suggestion. I'm pressed for time atm but if anyone wants to investigate, I'm happy to support.
The component started using await tick() in
https://github.com/janosh/svelte-multiselect/blob/fd8b37782cd508aacfc8125c6647cefe56144b80/src/lib/MultiSelect.svelte#L264