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: autoFilterFocus stuck when switching between Selects #6420

Closed
Tobberoth opened this issue Sep 17, 2024 · 1 comment · Fixed by #6510
Closed

Select: autoFilterFocus stuck when switching between Selects #6420

Tobberoth opened this issue Sep 17, 2024 · 1 comment · Fixed by #6510
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@Tobberoth
Copy link

Describe the bug

When switching between Select components with filter and autoFilterFocus set, the focus does not switch, unless user clicks outside of the selects to blur the first one.

I tried to recreate in the nuxt issue template, but it does not recognize the Select component.

A new nuxt project with PrimeVue and @primevue/nuxt-module with the following app.vue reproduces the error:

<script setup>
  const options1 = ref(["Foo", "Bar", "FooBar"])
</script>

<template>
  <Select :options="options1" filter autoFilterFocus />
  <Select :options="options1" filter autoFilterFocus />
</template>

Reproducer

Unable

PrimeVue version

4.0.7

Vue version

3.x

Language

ALL

Build / Runtime

Nuxt

Browser(s)

No response

Steps to reproduce the behavior

  1. Click Select 1, type something to assert that the filter is focused.
  2. Click Select 2, without clicking elsewhere first. Assert that Select 1 closes, and that Select 2 opens.
  3. Type text, notice that Select 1 opens and text is entered in the filter in Select 1, not in Select 2.

Expected behavior

As with MultiSelect, I expect the filter of Select 2 to be autofocused when it is opened.

@Tobberoth Tobberoth added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Sep 17, 2024
@avramz
Copy link
Contributor

avramz commented Oct 1, 2024

Can reproduce. Looks like setTimeout used in hide method is causing this, we need to execute focus after it.

@tugcekucukoglu tugcekucukoglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Oct 2, 2024
@tugcekucukoglu tugcekucukoglu added this to the 4.1.0 milestone Oct 2, 2024
@tugcekucukoglu tugcekucukoglu self-assigned this Oct 2, 2024
tugcekucukoglu added a commit that referenced this issue Oct 2, 2024
#6420 fix: Select: autoFilterFocus stuck when switching between Selects
tugcekucukoglu added a commit that referenced this issue Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants