multiselect
multiselect copied to clipboard
Select option on TAB (or provide an onSelect config)
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)
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);
}
}