multiselect icon indicating copy to clipboard operation
multiselect copied to clipboard

Select option on TAB (or provide an onSelect config)

Open mfrascati opened this issue 2 years ago • 1 comments

Description

Using the component as a select replacement can be quite frustrating while typing and pressing TAB, since even if i select an option with keys, when TAB is pressed the option is not selected.

It would be perfect if the option could be selected the same way it does when enter is pressed. Maybe an onSelect config could be used supporting tab|enter as values (the same way as addOptionOn does)

mfrascati avatar Oct 18 '23 21:10 mfrascati

As a workaround, you can implement a @keydown="onKeyDown" handler.

function onKeyDown(event: Event, instance: InstanceType<typeof Multiselect>) {
  if ((event as KeyboardEvent).key === "Tab" && instance.pointer !== null) {
    instance.select(instance.pointer);
  }
}

abaumg avatar May 07 '24 07:05 abaumg