Multiselect using Control key causes the list to jump

Hey everyone, I had an issue reported to me by an end user and is reproducible on the select2 documentation site.

Instructions to reproduce:

  1. On the Multi-select boxes (pillbox) example, open the select box.
  2. Scroll down the list to Hawaii. Hold the Control key on your keyboard and select Hawaii.
  3. Release Control key and scroll down the list.
  4. Scroll down the list to Oregon. Hold the Control key and select Oregon.
  5. You should now be back to Hawaii being displayed in the list.

I have tested this against:

  • Chrome 62
  • Firefox 57
  • Edge 40

I’m not sure if this is the expected behavior to go back to the first selected option in the list, or if it’s a bug. When doing the reverse…starting from the bottom, you don’t notice the behavior because it always goes to the first selected option in the list.

This seems like a bug and was reported as such to me. I would expect it to stay right where it was on the newly selected option.

Thoughts?

Thanks,

Eric

Have you seen https://github.com/select2/select2/issues/4417? There is an open PR for a configurable option that I hope to release in 4.1.

Nailed it! Thanks @alexweissman

1 Like