Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select option on TAB (or provide an onSelect config) #374

Open
mfrascati opened this issue Oct 18, 2023 · 1 comment
Open

Select option on TAB (or provide an onSelect config) #374

mfrascati opened this issue Oct 18, 2023 · 1 comment

Comments

@mfrascati
Copy link

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)

@abaumg
Copy link

abaumg commented May 7, 2024

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);
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants