Skip to content

Option to disable the keeping of focus after selection #1743

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

Open
J-Michalek opened this issue Jan 6, 2023 · 2 comments
Open

Option to disable the keeping of focus after selection #1743

J-Michalek opened this issue Jan 6, 2023 · 2 comments

Comments

@J-Michalek
Copy link

Is your feature request related to a problem? Please describe.
We were used to the input loosing focus after an option was selected and would like to have a way to preserve the functionality.

Describe the solution you'd like
I would like a prop being added that makes the behavior the same as before the changes made here.

Describe alternatives you've considered
Functioning workaround:

<v-select
  ref="vSelect"
  @close="
    () => {
      $refs.vSelect?.$el.querySelector('input[type=search]')?.blur();
    }
  "
>
@ipa1981
Copy link

ipa1981 commented Jul 10, 2023

While the workaround could be easier (below), I support the idea for a specific prop to keep the code more elegant:

<v-select @close="$el.querySelector('input[type=search]')?.blur()">

@frufin
Copy link

frufin commented Jan 14, 2025

In case of multiple v-select components inside a template, we should improve @ipa1981 answer that only closes the first component:

<v-select @close="selectClose($el)">

methods: { selectClose($el) { for (const i of $el.querySelectorAll('input[type=search]')) { i.blur() } }, }

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

3 participants